How to Conveniently Install and Manage Common Development Tools on a Mac
Published: 2016-10-30
Problem background
When developing on a Mac, you inevitably need to install tools or other programs, such as Git, Node, Maven, and so on. On Windows, these tools often must be downloaded and installed one by one, whereas on a Mac there is a handy tool —HomeBrew
— which helps us install and manage many common tools. If you are a Mac newcomer who hasn’t used HomeBrew yet, this post is especially for you, because when developing on a Mac, HomeBrew will quickly become an indispensable tool for everyday work and travel...
Solution
First, a brief introduction to HomeBrew. HomeBrew is a package manager used to install Unix tools that are not included with OS X. Below we’ll explain in detail how to install and use HomeBrew:
Because HomeBrew depends on Ruby, we need to have Ruby installed first. One way to get Ruby on a Mac is to install Xcode, since Xcode installs the development packages required by the Unix environment, which include Ruby (macOS is built on a Unix-based kernel). I won’t repeat how to install Xcode here — just get it from the App Store.
First check whether Xcode is installed by running the command xcode-select -p
Check whether Ruby’s version is correct by running ruby -v
Open your browser and go to the HomeBrew official websitehttp://brew.sh/, then paste the script from the webpage into your terminal
After it finishes, you can type brew in the terminal to see HomeBrew’s basic usage
Once HomeBrew is installed, use brew install to install many packages at once, for example brew install git node maven mongodb. You can list one or multiple packages as needed. HomeBrew installs these tools under /usr/local/Cellar and creates symbolic links in /usr/local/bin. Use brew list to see which packages were installed via HomeBrew. For more detailed usage instructions, please refer to theofficial documentation on GitHub.
Last updated