Skip to content

Instantly share code, notes, and snippets.

@TRex22
Last active September 1, 2018 06:26
Show Gist options
  • Save TRex22/0978ba572021ea6f1d0302ffa381be9b to your computer and use it in GitHub Desktop.
Save TRex22/0978ba572021ea6f1d0302ffa381be9b to your computer and use it in GitHub Desktop.
Fixing Homebrew, rails (rvm) and any other dev environment stuff after a mac machine transfer or some other disaster

Some hints and tips and things to try when something goes awry with Homebrew, gem or npm

If dtrace is not working correctly when trying to build packages (like gems or npm packages)

rvm install 2.3.5 -- --disable-dtrace

You can write the installed brews to a list on your old machine:

brew list > brews.txt

Then copy that file to the new machine and install them:

Uninstall and reinstall Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Redo all Brew Packages - may have to be run many times

for f in $(cat brews.txt); do brew uninstall --force $f; done
brew cleanup
for f in $(cat brews.txt); do brew install $f; done

This won't preserve any options you used when installing - you can do that too with a more complex script using the JSON output of brew info, if you're interested.

If node-gyp gives trouble

https://github.com/nodejs/node-gyp/issues/569

Reinstall xcode-select

  1. removing the old tools ($ rm -rf /Library/Developer/CommandLineTools)
  2. install xcode command line tools again ($ xcode-select --install).
  3. After these steps you will see a pop to install the new version of the tools.

Links

Homebrew and Machine transfer · Issue #32264 · Homebrew/legacy-homebrew · GitHub

Home · rbenv/ruby-build Wiki · GitHub

Htop on a mac

brew install htop wont work use brew install htop-osx for mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment