A lot of tutorials skip the preparation of a system for development. There’s a lot of important steps in going from a new operating system with no development tools at all to one where the command pip install or npm install actually work.

Setting up a development environment is a good investment in time, and it can let you focus more brain power on learning new languages and frameworks, and not wrestling with your operating system. If you’ve never developed on a mac before, this is a good place to start.

For this post, we are going to assume you have either a brand new mac (Congrats!) or a mac with some miles on it and stories to tell. Depending on language you want to develop, anything relatively recent should work.

Step 1: Should you use a different user account?

One thing to think about is if you should create a new user on your mac just for development. If you share your computer with someone else, or if you have used your mac for a while and have all your vacation photos all over your desktop, it may make things simpler to just create a new account to start with. This keeps your “General” account in tact, but then you can log in to your super-serious coding account when your ready to develop some code. You can put in a cool hacker background too.

Think about this before moving on, especially if you share your mac with someone else. Your significant other doesn’t want to see the python file next to their pictures, and it can prevent arguments about how to organize all of your files, which brings us to our next item…

Step 2: Determine where you want to put all your code.

It’s good practice to code in your home folder. If you don’t know where that is, it is the folder that is named after your account name. In my case it would be Mstudley. I like to put the following folder structure into place:

  • Matt’s Home Folder
    • Development
      • Mean
      • Python
      • Java

I prefer this kind of structure because it keeps everything nice and tidy and keeps your code files out of the other areas that OSX might need. During your coding adventures you will be installing a lot of helper-code (frameworks and APIs) and you’ll want to avoid mixing your files in with them. Speaking of installing frameworks…

Step 3: Install Command Line Tools for Xcode

This first step gives you the very basic development core that all Mac OS X machines have. You don’t need an Apple developer license for this, so don’t worry about that if you aren’t planning on doing XCode development.

To install, open a terminal and enter:

xcode-select –install

This will pop up a dialog box and ask you to install the command line tools. Once that is done, you’re ready to…

Step 4: Install Brew

What is brew? Brew is a package manager. It allows you to use your terminal window to install tools and frameworks quickly, and not have to worry about the correct location to put them in. Tell brew to install it – and for most frameworks – you’re done. Think of brew like the nurse that hands the doctor their instruments. Scapel!!

Brew’s website is pretty easy to follow and I invite you to do so now, since we’ll use brew from now on.

Did you get brew installed? If there was a problem, try browsing Stack Exchange for solutions. If your new to development, it’s a Q & A site for developers and developers young and old use it a lot.

 Step 5: Install and setup source control

Source control on your Mac:

What is source control and why do I need it for my own development machine? Source control is actually a critical piece of any development environment. It not only lets you control your own code by tracking every change you make (and allowing you to reverse them), but it also is used to acquire code. There’s a lot of frameworks that use source control as the primary code delivery function. Actually, it’s the system Brew uses to install all those frameworks you’ll use. Specifically, that’s Git.

Git is currently the front runner for source control programs. There’s also Mecurial. You don’t see centralized source control much anymore, but SVN / Subversion is the most prominent one.

The good news is that if you installed XCode Command Line tools properly, Git installed as part of those tools, so you should be all set on your system. To make sure, type this in a command line terminal:

git –version

If you get a response like ‘git version x.y.z’ then you’re all set. If you get a ‘command not found’ message, we’ll need to do some troubleshooting. Try this stack exchange query.

Source control in the cloud:

So this is something that often gets missed. You don’t just need Git or Mecurial. You will, at some point early in your coding career, need to get a source control account on the web. I won’t get into the debating of which provider is better here, but I invite you to look at the list below and sign up for one. They are all free, and give you a place to store your code and access it from anywhere. It also looks really good on a resume.

Centralized repositories, like Subversion, are usually paid for and behind closed doors, used at a lot of software companies but falling out of favor. You’ll still see it in some industries with a lot of hardware development or mainframes (Finance and Data Storage  for example).

Step 6: Install a nice code editor

Code editors are a big subject and there are as many code editors as there are different car models. We won’t be getting into which is best here, that’s another series of articles.

You’re going to want to install a code editor that gives you a balance of features and speed. Light weight text editors load fast and take little memory but don’t always have great features. The other end of the spectrum are IDE (Integrated Development Environments). These actually code for you, but they can take gigabytes of space and memory.

Your editor choice is informed heavily by which language and frameworks you’ll be using. If your going to do iOS application development for iPhone, you’ll need to get XCode – it’s proprietary to Apple and most code examples you’ll find assume you are using it.

If you’re programming any of the many scripting languages, like Python, Javascript, or PHP (aka web app development) try a middle ground editor. I prefer Atom. Microsoft is making a good effort as well with Visual Studio Code. Either of these two will get you started.

For major full-featured IDEs – check out JetBrain’s IDEs.  If you are completey new to programming, I would NOT use these yet. They aren’t free for some features and have a lot of tools that professionals love but might be too much to try to learn at once for someone just getting started.

Step 7: Start a project!

You’re ready to start a project! Pick a language, install the frameworks and tools, and off you go. The words “Install the frameworks and tools” that I just mentioned glosses over mountains of stuff, and other articles will go over those.

For now, take a break and treat yourself to some coffee. You’ve gone from zero to having a development Mac ready to go!

Remember: Create a repository in your source control site (Github or bitbucket or whatever you chose) for each of your projects! The first time you need your code on anything except your own computer, you’ll love the fact you did this.

Good luck and may your code be bug free!