If you came here looking how to install Xcode using brew (aka Homebrew), read this part first. Otherwise, skip to the introduction.
The solution depends on your answer to this question:
^M usually means r as in r which is windows line endings. You should try to open /usr/local/bin/brew and save it with unix line endings or use the command line to dos2unix to do the job for you: dos2unix /usr/local/bin/brew. You might encounter other files with the same problem, eg: usr/local/Library/brew.sh. The first method is termed as an upgrade install, also known as the default method. The second method is known as a clean install. Mac OS X El Capitan 10.11 DMG Install and Download. Upgrade install-Follow to below steps-Visit the Mac App Store. To upgrade from Lion or Mountain Lion, first upgrade to El Capitan, then upgrade to. However, at the time of writing the script is not compatible with OS X El Capitan (10.11) Install MySQL using Homebrew An alternative to the aforementioned installation script is installing MySQL using Homebrew. This gist assumes you already have Homebrew installed, if not first read the article ' Homebrew and El Capitan '. Homebrew complements macOS (or your Linux system). Install your RubyGems with gem and their dependencies with brew. “To install, drag this icon” no more. Homebrew Cask installs macOS apps, fonts and plugins and other non-open source software. $ brew install -cask firefox. Making a cask is as simple as creating a formula. I upgraded to El Capitan, with Homebrew & Ruby, and this is how I did it flawlessly. And Xcode and Java, etc. If you don't already have homebrew installed, do that first, so you don't have to deal with SIP issues. Install all Software Updates available in the Apple Menu, up to and including El Capitan.
- Are you planning on developing iOS or Mac applications?
If the answer is “no”, then you do not need Xcode. All you need are the standalone Command Line Tools, which you can install by reading this guide.
If the answer is “yes”, then you will need to download and install Xcode from the Apple App Store. Xcode is a Mac application built by Apple, and it cannot be installed with Homebrew.
Even if you answered “yes”, you will still need Homebrew and Ruby to install cocoapods or fastlane, for example, so you should read this guide.
Introduction
After following many outdated and incomplete instructions for setting up a web development environment on a Mac (back in March 2012), and spending a lot of time finding solutions to the problems I encountered along the way, I decided to put together this detailed tutorial.
Over time, the tools got better, and ever since Mavericks, setting up a development environment on a Mac with Apple’s standalone Command Line Tools, Homebrew, Git, a Ruby manager (such as chruby, rbenv, or RVM), Ruby, and Rails has been a fairly stress-free process that’s no longer fraught with the issues I ran into in 2012.
In fact, the whole process can now be automated via the script that I wrote for you.
While it’s certainly possible to set everything up manually, it’s not as straightforward to explain because there are more options to consider in 2021. For example, the installation instructions will differ depending on your shell (Bash, zsh or fish), or if you are using a Mac with the Apple Silicon (M1) chip versus an Intel chip.
My script is smart enough to detect your current setup and install everything in the right place.
If you prefer to do everything manually, keep reading. This tutorial is kept up to date and is guaranteed to work in 2021.
Prerequisites
Supported macOS versions:
- Big Sur
- Catalina
- Mojave
Your macOS software is up to date
Before you start, make sure you have the latest Apple software updates for your current macOS version. Check by going to System Preferences, then Software Update. Imvu texture extractor license branch.
Homebrew is ready to brew
You can skip this section if you know you haven’t tried to install Homebrew yet. If you’re not sure, check the contents of the /usr/local
folder (also check /opt/homebrew
if you’re on a Mac with the Apple Silicon chip). Run this command in the Terminal
app:
If there’s nothing in the folder, then you don’t have Homebrew.
If you’ve already installed Homebrew, you’ll want to make sure that when you run brew doctor
, it says Your system is ready to brew
.
If it’s not ready to brew, one of the most common issues, and the first one you should fix, is missing or outdated Command Line Tools. The outdated tools message looks like this:
Here are other variations of the outdated message:
The missing tools message looks like this:
Homebrew usually provides detailed instructions for fixing things, so read carefully and follow their instructions. Quit and restart Terminal once the CLT are installed.
If you get errors other than the ones above, read through the Troubleshooting Homebrew section at the bottom of this guide.
You don’t have RVM or rbenv installed
Back in 2012, I used to use RVM, but once I automated this process, RVM kept breaking my script, so I switched to the much simpler chruby
and have been using it happily every since. chruby
is not compatible with RVM and rbenv, so you’ll need to uninstall them first.
Uninstall RVM
Then delete any lines related to RVM from these files if they exist:
~/.bash_profile
~/.zshrc
~/.zprofile
Uninstall rbenv
Follow the rbenv uninstallation instructions, then delete any lines related to rbenv
from these files if they exist:
~/.bash_profile
~/.zshrc
~/.zprofile
If you don’t know what the ~
means, or how to edit the files above, read my guide about how to open and edit hidden files (or dotfiles) on a Mac.
El Capitan Download
Installation
Notes on Terminal
Most of the work you’ll be doing in this tutorial will be in the “Terminal” application.The easiest way to open an application in macOS is to search for it via Spotlight.
The default keyboard shortcut for invoking Spotlight is command-Space
. Once Spotlight is up, start typing the first few letters of the app you are looking for, and once it appears, select it, and press return
to launch it.
If you are on an M1 Mac, make sure Terminal is NOT in Rosetta mode.
You can check by running this command once Terminal opens:
It should say arm64
if you are on an M1 Mac. If it says x86_4
, that means Terminal is in Rosetta mode. The only way this could happen is if you changed the setting yourself, most likely after following incorrect or outdated advice. To turn off Rosetta, follow these instructions:
- Quit Terminal if it’s running
- Go to the Finder
- Go to the Utilities folder by pressing
shift-command-U
(or select “Go” from the menu bar, then select Utilities) - Select Terminal, but don’t launch it. Just click once to select it.
- Press
command-i
(or from the menu bar: “File”, then “Get Info”) - Uncheck the checkbox that says “Open using Rosetta”
- Close the Terminal Info window
- Launch Terminal
- Run
uname -m
. It should now sayarm64
and you can proceed with the rest of this guide.
Notes on your shell
This tutorials assumes you are using zsh
. If you’re not sure, read my guide to find out which shell you are using, and replace any references to .zshrc
in the steps below with .bash_profile
if you are using Bash.
Step 1: Install Homebrew and the Command Line Tools
Homebrew, “the missing package manager for macOS,” allows you to easily install hundreds of open-source tools. The full installation instructions are available in the Homebrew Documentation, but you should only need to run the command that’s listed at the top of the Homebrew site:
Note that the command listed on the Homebrew site could change, so please make sure that what I have listed above is the same. If it isn’t, please let me know and I’ll update it.
Copy and paste the command into your Terminal window, press return
, then read what appears in the Terminal, and pay attention to any instructions that require your input. For example, Homebrew will prompt for your macOS password. Note that Terminal does not provide visual feedback when you type your password. Just type it slowly and press return.
Homebrew also automatically installs the Apple Command Line Tools, and it usually installs them in the background, but in case this changes, pay attention if any windows appear that require your input.
Once the installation is successful, quit and restart Terminal, then check if Homebrew is ready to go:
If you get Your system is ready to brew
, you can move on to Step 2. Otherwise, read what Homebrew is saying very carefully. They usually provide great instructions that you should follow. If that doesn’t help, go to the Troubleshooting section to learn how to fix errors and warnings you might run into.
On Apple Silicon Macs, Homebrew might tell you to run a few commands after the installation:
Quit and restart Terminal, then check if everything is working so far:
Step 2: Install chruby and the latest Ruby with ruby-install
Install chruby
and ruby-install
:
Install Ruby 2.7.2:
There is a newer version of Ruby (3.0.1), but it’s not fully compatible with some gems such as Jekyll, so I recommend 2.7.2 to get started. You can always install any other available version of Ruby, in addition to 2.7.2. That’s the advantage of using a Ruby manager like chruby
. You can have multiple versions on your computer at the same time, and you can easily switch between them.
This will take a few minutes, and once it’s done, configure your shell to automatically use chruby
:
For Intel Macs
For Apple Silicon Macs
Quit and relaunch Terminal, then check that everything is working:
It should say ruby 2.7.2p137
.
Step 3: Configure Rubygems
Disable downloading documentation when install gems (for faster installation):
Make sure Rubygems is up to date:
Step 4: Install and configure Bundler
Install Bundler:
Configure Bundler to take advantage of your computer’s cores:
Step 5: Install any other gem you want
Congrats! You now have a working Ruby development environment. You should now be able to installs Rails, or Jekyll, or whatever gem you’ve been trying to install for the past few days!
If you got any value out of my tutorial, join the 1600+ people who are becoming confident coders through my quality guides and exclusive content in my free newsletter.
Step 6: Install Git
Git is the version control system of choice among many web developers. With Homebrew, installing Git is as easy as this:
Since we just installed Homebrew, we could have skipped brew update
, but it’s a good habit to run it before installing anything with Homebrew because Homebrew is updated regularly.
Quit and relaunch Terminal, then verify the Git installation:
You should get git version 2.31.1
or later.
Next, you’ll need to configure Git with your name and email, and other important settings.
Next Steps
Once you start coding away on your computer, you will most likely need to install more tools with Homebrew. Before you do, remember to always run brew update
and brew doctor
to make sure your system is still ready to brew. To upgrade your existing packages, run brew upgrade
. It’s important to keep your development environment up to date, and Homebrew is just one of the tools you need to remember to update.
Knowing when and how to automate is a sign of an effective engineer. Most things you do repeatedly will add up to a lot of wasted time if you don’t find ways to speed them up.
That’s why I recommend taking advantage of my script, which allows you to keep your system up to date by typing a single word in your Terminal. It does that by adding an alias, which is a shortcut for the longer command. If you’re not familiar with aliases, read my guide about how aliases can speed up your workflow.
Troubleshooting Homebrew warnings and errors
Consider starting over from scratch
Before you start looking through this list and trying to fix every warning and error, I would suggest a quick and easy solution: uninstall Homebrew and start over from scratch.
Before you do that, make a backup of everything you installed with Homebrew:
This will create a Brewfile
in your ~/backups
directory, which you can refer to later in case you’re missing something you need. For now, I wouldn’t worry about installing everything you used to have. It’s better to start with a clean slate, and only add things that you absolutely need.
If you installed a database with Homebrew (such as Postgres), and stored data that you need, back it up first. It is unusual to have important data stored in a local database and nowehere else, but I’m mentioning it for completeness.
Then uninstall Homebrew:
This will not completely remove all Homebrew folders, so you’ll need to finish the job:
This will prompt you for your macOS password, and then it will say:
This is expected because you can’t delete the /usr/local
folder itself, but you can delete anything inside it. On a brand new Mac, the /usr/local
folder already exists, but it is empty.
To verify that Homebrew was completely removed, check the contents of the /usr/local
folder:
Homebrew El Capitan Download
It should be empty.
If you are on an M1 Mac, you’ll also need to delete the /opt/homebrew
directory:
Verify that the opt
folder no longer has anything inside it:
Then go back to step 1, and after you complete this tutorial, if all your coding projects are still working, then you’re good to go. Otherwise, if you get errors because tools are missing, install them as you need them with Homebrew.
Fix brew issues one by one
In many cases, Homebrew will provide helpful instructions for dealing with warnings and errors, and I usually follow those instructions. I’ve tried to cover the most common sources of warnings and errors.
If you run into an issue I haven’t mentioned, try looking it up in the Homebrew GitHub Issues, or search for the error message on DuckDuckGo. If that doesn’t help, subscribe to my newsletter and I’ll do my best to help you.
After you fix each issue, run brew doctor
until you get Your system is ready to brew
. Then go to Step 2.
PATH issues
If you get Warning: /usr/bin occurs before /usr/local/bin
, run the command below (as recommended by Homebrew), and quit and relaunch Terminal:
Read my guide about PATH to understand why this is important.
Other similar PATH issues you might see:
Missing directory errors
sudo
allows you to run commands as a user with higher access rights, which is why it prompts you for your password, and mkdir
stands for “make directory.”
chown
stands for “change owner,” the -R
flag applies this to all nested files and directories, and whoami
is a variable that represents your macOS username. You should copy and paste the commands above as is.
Permission errors
If you get /usr/local/etc isn't writable
or Cannot write to /usr/local/Cellar
or if it complains that any directories inside /usr/local
aren’t writable, fix it with this command:
This makes you the owner of the /usr/local
directory, in addition to all nested directories.
Unbrewed files
Here are examples of common warnings about unbrewed files:
If you get a warning about any type of unbrewed file (such as .pc
files, or static libraries), you may need to delete them as suggested by Homebrew (unless you put them there on purpose, which is unlikely). You’ll have to delete each file it complains about one by one with the rm
command. For example, to remove a file called libgd.2.0.0.dylib
from /usr/local/lib
, you would run this command:
In some cases, it might list a bunch of files that are all in the same directory, as in this example where something went wrong when installing Node:
In this case, you can delete the entire directory that contains the unbrewed files:
Python warnings and config scripts
A related issue is:
These most likely mean you installed Python with a tool other than Homebrew. If you think you might need this version of Python, then just ignore those warnings. Otherwise, run the command below to remove that version of Python, but read this thread first.
In general, you want to install all development tools with Homebrew.
Outdated or misconfigured Xcode
Unless you plan on building iOS or Mac applications, you don’t need Xcode. All you need are the standalone Command Line Tools, which are installed when you follow this tutorial. If you already installed Xcode, you can safely delete it (again, assuming you haven’t used it and don’t plan to use it).
So, if you get any of the errors below, delete Xcode, then run brew doctor
.
Outdated Xcode
Misconfigured Xcode
Linking keg-only formula
Homebrew messages are generally very helpful and they let you know exactly what to do. In this case, it is telling you to fix the linking issue by running brew unlink
, followed by the tools (or “brews”) that need to be unlinked. Here, there is only one tool that needs to be unlinked. Therefore, you should run this command:
If it listed more than one tool, you would add them to the command separated by a space, like so:
Unlinked kegs
Broken symlinks
Use brew cleanup
to fix these types of warnings:
El Capitan Theatre Hollywood Ca
Deprecated taps
In this case, you need to add the specific cask to the brew untap
command, such as:
Missing dependencies
The instructions here are straightforward:
Issues with the Git repo
Follow the instructions:
Prefix issues on Apple Silicon
This is caused if you installed Homebrew while running your terminal in Rosetta mode, and are now running it in native mode, or if you used arch -x86_64
while in native mode, or other types of mixing the two environments.
Most things you need for Ruby web development are supported in native mode now, so there’s no need to use Rosetta anymore. For more details and things to look out for, read my guide on installing a development environment on Apple Silicon. Wind waker hd wii u iso.
On macOS systems GNU Octave can be installed by:
- macOS App Bundles 'Octave.app' (a single dmg-file)
- macOS package managers.
macOS App Bundles[edit]
The Octave.app project provides an unofficial ready-to-use, drag-and-drop macOS App installer based on Homebrew (see below).
A very old installer is hosted on SourceForge.
- macOS App Bundle of Octave 4.0.3 (with GUI) (OS X 10.9+)
Package Managers[edit]
All package managers below are given in alphabetical order. The Octave developers do not recommend a certain package manager.
Homebrew[edit]
→ Link to Octave package there.
Homebrew was written 2009 by Max Howell and has gained popularity in the Ruby on Rails community and earned praise for its extensibility.
Install GNU Octave using Homebrew:
- Install Xcode via the Mac App Store.
- Install the Command Line Tools by opening a terminal and type
- Follow Homebrew's installation instructions.
- Ensure brew itself has the latest definitions
- Install Octave
Further reading[edit]
The default charting package in Octave is straight qt. However, on the Mac gnuplot often works better. To switch to gnuplot, place the following text in your ~/.octaverc file:
Note: If brew complains about:
This is telling you the user permissions for ghostscript are not setup in a way that your user profile can use. You need to change those permissions to your user profile.The following command will repair the issue:
Then run the brew install octave
command again.
Note: If brew complains about not having a formula for octave, the following command should fix it:
The command below upgrades Octave and its dependencies to the latest Homebrew-supported versions:
Octave has a built-in GUI (developed using Qt lib) installed by default so that gnuplot and other tools can use it directly. This GUI is always installed when installing Octave using Homebrew.
In case of trouble, see the Homebrew Troubleshooting Guide, which assists in diagnosing problems and craft useful bug reports. Bugs may be reported at Homebrew-core's issue tracker.
MacPorts[edit]
→ Link to Octave package there.
MacPorts, formerly called DarwinPorts, was started in 2002 as part of the OpenDarwin project, with the involvement of a number of Apple Inc. employees including Landon Fuller, Kevin Van Vechten, and Jordan Hubbard.
Install GNU Octave using MacPorts:
- Install Xcode via the Mac App Store.
- Install the Command Line Tools by opening a terminal and type
- Follow MacPorts' installation instructions.
- Update your installation
- Install Octave
Spack[edit]
→ Link to Octave package there.
Spack is a package management tool that supports the installation of multiple versions of software on macOS and other operating systems. It was created 2013 by Todd Gamblin and is currently being updated and developed by a large list of contributors (mainly via GitHub).
Install GNU Octave using Spack:
- Install Xcode via the Mac App Store.
- Install the Command Line Tools by opening a terminal and type
- Follow Spack tutorial.
- Update Spack by going to the local Spack repository (develop branch) folder and run
- Install Octave
- To use Octave we need to first load the package
In case of trouble, please visit the Spack repo issues list, and browse through Octave related issues by writing is:issue octave
in the filters box.
Create a launcher app with the Script Editor[edit]
For example Homebrew installs Octave to /usr/local/bin/octave by default. From the Terminal application you can enter the command which octave
to find out the exact location.
If you know the installation location, open the Script Editor application and write the following text in the editor window:
if you wish to start the Octave GUI by default. If you want to start the Octave command-line interface (CLI), enter instead:
or if Octave is in your default path:
Finally:
- With a script open in the Script Editor app on your Mac, choose 'File > Export'.
- In the menu that appears, select 'Application' from the 'File format' menu, then navigate to the 'Applications' folder and save your script there as 'Octave.app'
To change the application icon:
- Open this link in a web browser, right-click and select 'copy image'.
- Select 'Octave.app' in the Finder, then press command-i to bring up the file info dialog.
- In the file info dialog, select the icon (in the top left) and press command-v to paste the Octave icon over it.
See also[edit]
- Octave for macOS (outdated) contains old installation instructions.