Sitemap

Bad CPU type in executable

Lee young-jun
3 min readApr 24, 2025

--

This time I bought a new macbook Pro M4 to replace old macbook Pro intel 2018.

After finishing the migration, I tried to open iOS project with Tuist.

mise x -- tuist generate

However I encountered this error

-bash: /usr/local/bin/mise: Bad CPU type in executable

I guessed it was caused the mise installed for Intel and attempted to reinstall mise using brew.

brew install mise

The brew also didn’t work.

/usr/local/Homebrew/Library/Homebrew/brew.sh: line 1018: /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin/ruby: Bad CPU type in executable

Ruby

According to the error message, the root reason might be ruby.
I check the version of ruby.

ruby --version

The command was failed, but I could get the version string.

-bash: /usr/local/Cellar/ruby/3.3.0/bin/ruby: Bad CPU type in executable

Gem

I wanted to uninstall ruby 3.3.0 if it is installed with gem.

sudo gem uninstall ruby -v 3.3.0

gem was also unavailble.

sudo: unable to execute /usr/local/Cellar/ruby/3.3.0/bin/gem: Bad CPU type in executable

Uninstalling Homebrew

I ran the command from brew site with uninstall.sh intead of install.sh.

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then It will warn you

Are you sure you want to uninstall Homebrew? This will remove your installed packages!

So you should check first if it is installed packages.

And I ran install.sh command this time.

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

It seemed like failed due to the last message.

Failed during: /opt/homebrew/bin/brew update — force — quiet

I just ran it again and no more the failed message.

To allow run brew on Terminal, I followed the instruction.

echo >> /Users/LYJ/.bash_profile
echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”’ >> /Users/LYJ/.bash_profile
eval “$(/opt/homebrew/bin/brew shellenv)”

After installing brew, I checked also ruby.

ruby -- version

It was lower than 3.3.0.

ruby 2.6.10p210 (2022–04–12 revision 67958) [universal.arm64e-darwin24]

So I installed ruby version 3.3.0 manually.

sudo gem install ruby -v 3.3.0

However gem couldn’t find ruby ‘3.3.0’

ERROR: Could not find a valid gem ‘ruby’ (= 3.3.0) in any repository

I tried to install ruby again with brew.

brew install rbenv
brew install ruby@3.3.0

It showed other versions.

There was 3.3 instead of 3.3.0.

brew install ruby@3.3

After registering ruby on environment.

echo ‘export PATH=”/opt/homebrew/opt/ruby@3.3/bin:$PATH”’ >> /Users/LYJ/.bash_profile

I could see ruby version.

ruby --version

ruby 3.3.8 (2025–04–09 revision b200bad6cd) [arm64-darwin24]

Now mise installation works.

brew install mise

And I can Tuist now!

If you found this post helpful, please give it a round of applause 👏. Explore more Tuist-related content in my other posts.

For additional insights and updates, check out my LinkedInprofile. Thank you for your support!

References

--

--

No responses yet