I recently needed to install cc65 (http://cc65.github.io/cc65/index.html) on OS X. Sounds easy enough. However, a binary distribution for OS X does not exist! This means it must be built from source code.
To complicate things, instructions I found only carried through the compilation. The current source (2.15 as of this posting) would not process the ‘make install’ on OS X 10.11 El Capitan. A little coercion was needed.
Here you will find how I got it to install.
First, you need Xcode. You can install the full package from the Mac App store, or you can install just the command line tools. If you want to install just the command line tools, an easy way is to open the Terminal and type ‘make’. OS X will ask if you want to install them via GUI. Once you elect to install, accept the license agreement.
If you installed the full version of Xcode, execute it once and accept the license agreement. Or if you prefer you can use the Terminal command:
Download the cc65 sources from Github (https://github.com/cc65/cc65). To do so, just click the green “Clone or Download” button in the top right, and select “Download zip”. This will download a file called ‘cc65-master.zip’ to your download folder.
Extract the contents of ‘cc65-master.zip’. The easiest way is to double click it.
Change directory to the extracted folder. Use “cd fullpathname”.
Compile cc65 by using Xcode’s make. This will cause the cc65 sources to be compiled. They will be compiled into the extracted folder. It will only take a few minutes.
The next part requires admin privileges, so you need to use sudo. This will install the compiled binaries, libraries, and includes into a base location you pick. They will be placed in sub-directories of the base directory.
A good place to install is “/usr/local”. Set the prefix environment variable with the following command. This will allow installation of the binaries into /usr/local/bin, and everything else into “/usr/local/share/cc65/xxx” where xxx are various cc65 directories such as lib, target, include, etc:
Perform the install by entering “sudo make install”. A lot of messages will scroll by showing you what files were placed where. Review, save it, whatever, you likely won’t need it again.
Now you just need to add an environment variable to your profile so the cc65 tools are always available to you at login. If you don’t want to do this, fine, just remember you will have to set the variable before using the cc65 tools.
Change to your home directory:
Assuming you installed to “/usr/local”, you need to add the following to the file “.bash_profile”. Don’t panic if it doesn’t exist:
If you are familiar with vi, use it to edit “.bash_profile” and add the export above. If you are not, use the echo command to add it. Note this echo command will add to it if it already exists and create it if it does not:
echo "export CC65_HOME=/usr/local/share/cc65" >> .bash_profile"
That’s it. You can now use the cc65 tools.