Developers know the scenario: Just as you get comfortable with one machine, it comes time to upgrade to a new one. Maybe you’re used to wrestling your way through the setup process, running long lost commands until you run out of error messages. The New York Times Interactive News team is here to help.
Using this NPR tutorial as an example, I spent some time during my first days on the job here documenting my setup process. You can follow the steps below to set up your machine so that it’s ready to build and deploy like we do.
First a little context: Interactive News is a newsroom development team that builds software for newsgathering and storytelling. We use many different technologies; we’ve got running projects in Python, Node, Rails, Go and even Haskell. This guide focuses on the core technologies we use to create newsgathering tools like web scrapers, database frontends and other data-processing scripts.
A quick note before we begin: I’m using a recent-model MacBook Pro running macOS Sierra 10.12.
First things first: Open up your App Store and check to see if there are any new updates to install. You’ll want to make sure your computer is set up with the latest security and operational updates.
Next up? Command line tools. Open up your terminal, and run this command:
This will get your machine ready to install software packages that will help you as you begin to build news applications.
Your Terminal and Text Editor
As you just discovered, your Mac comes with a fully functional built-in terminal. But if you’re looking to get the most out of your experience I recommend using iTerm2, which gives you the flexibility to customize the number of vertical and horizontal panes in your window. iTerm2 also provides a robust search and autocomplete and allows you to set up a hotkey to launch the terminal quickly.
There are a handful of options for text editors, and personal preference will be your best way to decide. I use Atom, GitHub’s free and open-source text editor. Members of the team here also use Visual Studio Code, Vim, and Sublime Text 2.
Homebrew is a package manager that will help you install software quickly and painlessly. To install Homebrew, run this command from your terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Follow the instructions in the prompt. You’ll be all set with Homebrew once you see:
“Your system is ready to brew.”
We use a combination of Amazon Web Services and Google Cloud Services to host most of our scripts and public applications.
This section assumes that at least part of your work will be hosted with Amazon Web Services and that you’ve been set up through the AWS portal with an access key and secret access key.
Make a directory called .aws and change into it:
mkdir .aws cd .aws
Create two files, config and credentials:
touch config credentials
In config, paste in your AWS region:
[default] region = xx-xxxx-x
In credentials, paste in your AWS key and secret key:
[default] aws_access_key_id = xxxxxxxxxxxxxxxxxxxx aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GitHub SSH Keys
Whether you’ll be working solo or on a team, version control will allow you to keep track of your code in all its iterations. The Git client should come automatically installed on your machine, so you’ll just need to create an account on Github.
Once you’ve created a GitHub account, you’ll need to give your machine access to pull and push to repositories. GitHub’s documentation will help you through setting up your SSH keys.
For database software, the team uses a mix of MySQL, PostgreSQL, MongoDB, ElasticSearch or Redis depending on the needs of the project at hand. The news applications team tends to favor Postgres because of its configurability and capacity to load and query large amounts of data quickly.
Installing it with Homebrew is a snap. One command will help us to get Postgres ready to use:
brew install postgres
Python 3 and Virtual Environments
Your Mac comes with Python 2.7 pre-installed, which is great! We use Python 3 for new project builds, though. So that we can leave the system Python at 2.7, we only set Python 3 to default within virtual environments that sandbox your projects.
Here’s how to get started:
brew install python3 pip3 install --upgrade pip setuptools wheel sudo pip3 install virtualenv virtualenvwrapper
Add the following to your ~/.bash_profile:
export VIRTUALENV_PYTHON=/usr/local/bin/python3 export VIRTUALENVWRAPPER_PYTHON=$VIRTUALENV_PYTHON
In your terminal, type:
Google Cloud Platform
Finally, you will want to install what you will need for your deployment process. Most of the Interactive News team’s deployment infrastructure lives on the Google Cloud Platform, so my setup involved initializing Google Cloud SDK and Kubernetes services.
Still Need Help?
Set Up Your Mac Like an Interactive News Developer was originally published in Times Open on Medium, where people are continuing the conversation by highlighting and responding to this story.