To remove a package, you use the uninstall command. I really shouldn’t have used Node as an example □♂️… But I still decided to use it because nobody talked about the npm problem I mentioned above. So if you want to install any Node version, make sure you run install or reinstall instead. When you run brew `link node, Homebrew doesn’t install npm for you. Here’s the funny thing about Node + Homebrew. To change back to the latest node version, you repeat the unlink and link steps: brew unlink brew link node YouĬan only perform major version upgrade/downgrades. Semantic Versioning with Homebrew, so you can’t install specific versions. Unfortunately, with Homebrew, we don’t get to use Now if you run node -v, you should see that Node v10 is installed. Sometimes, (like in this case), you need to use -force to link the formula. To link a formula, you use the link command. Then, we need to link the version we installed. Next, we need to unlink our current node version. In this example, we can install node v8 or v10. You want to find the possible versions to download from the results. You want to downgrade to a previous version.įirst, you need to use brew search to find the package. Let’s say you have the latest version of Node installed. # Upgrades all packages to their latest version brew upgrade Downgrade a package To upgrade all packages, you use brew upgrade without specifying any formulas. To upgrade one package, you use this: # Upgrades one package to the latest version brew upgrade You can also find a list of formulae I use in my Dotfiles repository. If you’re feeling bored, here’s a list of everything you can install with Homebrew. brew install įor example, to install Node with Homebrew, you use this: brew install node To install a formula, you use the install command. # updates Homebrew brew update Installing a packageĮach package is called a formula. (You always want Homebrew to be at the latest version before downloading anything). This updates Homebrew to its latest version. You can install Homebrew with this command: # Installs Homebrew /usr/bin/ruby -e " $( curl -fsSL ) " Updating Homebrew In this article, I want to explain how to use Homebrew. It lets you download binaries, packages, and applications with a single command. It did the trick for me.Homebrew is a package manager for Mac OS. I hope this helps anyone who is trying to install rbenv on zsh. Ruby 2.7.2p137 ( revision 5445e04352) įinally, you’ll be able to install htmlbeautifier, like I did: $ gem install htmlbeautifier You can determine the latest stable version by running: $ rbenv install -lĪfter restarting the terminal again, do a quick sanity test to ensure that the right version of Ruby is being selected: $ ruby -v With rbenv ready to go, I installed the latest version of Ruby and set it as my global default for this machine. zshrc (or simply restart the terminal of your choice like iTerm2, instead): $ source ~/.zshrc This ensures that the previous file is sourced when a new session is started and that rbenv is initialized for Zsh.Īt this point, you’ll want to source. This adds gem-specific binaries to the PATH so that they are accessible to the shell without fully qualifying them with their path. zshenv: export PATH="$HOME/.rbenv/bin:$PATH" To ensure that rbenv is correctly loaded when we start a new shell, I had to edit a couple of files. $ brew update & brew install rbenv ruby-build The latter allows us to select a series of Ruby versions to chose from. I updated brew and used it to install rbenv and ruby-build. Unfortunately, following the usual setup instructions didn’t really work, so I’m sharing the setup that worked for me here. Instead, I like to have multiple versions through an environment management system such as rbenv or asdf.įor this particular machine, I picked rbenv. You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.Īt this point, you might be tempted to simply sudo it, but that’s not a smart approach. If you try it with the default system installation of Ruby, you’ll get a permission error: $ gem install htmlbeautifierĮRROR: While executing gem. I needed to install htmlbeautifier, a gem used by some prettifier extensions within Visual Studio Code. You can, of course, change it back to Bash, but I don’t mind Zsh (or Fish) so I decided to keep it. One of the changes that will impact you as a developer is that Apple switched the default shell from Bash to Zsh (Z shell). It’s not a polished product yet, but overall it’s been a fairly enjoyable operating system. Recently, I updated my Mac to the latest beta of macOS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |