Recently I had the joy of unboxing a brand new MacBook. It was a fantastic feeling to have the promise of all that computing power. Aside from marveling at the sleek design and the lack of butterfly keys, I needed to set up my development environment.
For my build I wanted to have python available to crunch numbers and do basic web development. This requires not only python, but some specialized packages and web design tools. The applications I chose to meet my stated requirements are outlined below and bucketed into three installation stages.
Stage 1 is the foundations stage. It involves the installation of x-code, brew, and a few other applications to put your zsh terminal into overdrive. The second stage is the data stage in which python and supporting database applications are installed. The last stage is the web development stage in which web design applications like node, yarn, and react are installed. All code snippets in this article can be copied and pasted directly into your mac bash or zsh terminal to speed installation. Let's get started!
In this stage installations focus on getting the right tools to make your terminal effective along with the package manager to get the necessary packages in later stages.
- Get xcode. Xcode is apples integrated development environment to build apps for Apple products. If your mac requests a restart for updates after this command that is expected and normal.
xcode -select --install
- Install brew. Brew is easy to use package / application manager that enables quick installation of a wide variety of packages. You will see how easy it is to use later on in the tutorial.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- Install iterm2. Iterm2 is a really great facelift to your terminal. It is very easy to use and has enhanced visualization functionality to keep things easy on the eyes. This installation is purely cosmetic and not required for later stages.
brew install iterm2
- Install oh-my-zsh. Oh my zsh, aside from having an awesome name, is another application that provides a cosmetic upgrade to your terminal. With this add on you can load themes and make your terminal even more personalized. This installation is purely cosmetic and not required for later stages.
brew install oh-my-zsh
- Install tree. Tree makes visualizing your directories easy. This installation is purely cosmetic and not required for later stages.
brew install tree
- Install git. Git is amazing and (in my mind) the optimal way to wrangle version control. If you're a stranger to version control you should read up on it using their free manual here.
brew install git
During this stage python is installed along with supporting database applications.
- Install python. No introduction needed here. Keep in mind that when you install the command below python 3 is installed. In doing so the updated integrated package manager pip3 is installed instead of pip. This is important to keep in mind as you work with python 3 because many tutorials requiring package installations reference pip as the primary package manager and can cause some frustration. If it really bothers you (like it does for me) you can create an alias in your .bash_profile or .zshrc file so you can use pip v pip3 to install python packages in the future.
brew install python
- Install pipenv. Pipenv (as noted in an earlier post) is a great way to keep track of package dependencies your python scripts or applications.
brew install pipenv
- Install postgres. Postgres is the worlds most popular open source relational database platform. I don't consider myself a postgres expert. However, I like the idea of having it available if needed for basic python applications.
brew install postgres
- Install mysql. Why have one open source relational database platform when you can have two?
brew install mysql
- Install mongodb. This is another popular db solution. First we have to update our brew directory from mongo's repository followed by installing the community version.
brew tap mongodb/brew brew install firstname.lastname@example.org
- Install numpy, scipy, matplotlib, and pandas python packages. These will likely be important for any work you do to crunch data in python, so having them globally is to your benefit.
pip3 install numpy scipy matplotlib pandas
- Get Visual Studio Code. At one time I was an avid user of atom. However, I've had issues with my favorite python packages getting out of sync with atom releases. I've since transitioned to vs code as a consequence. VS code has a python package that is maintained by Microsoft and comes out of the box with excellent functionality to supercharge your workflows including an integrated terminal and interactive jupyter terminal.
brew cask install visual-studio-code
Web Development Stage
During this stage key applications are installed for web development with python.
brew install node
brew install yarn
yarn global add create-react-app react-scripts
- Install flask. Flask is a python package that enables you to develop a robust python backend complementary to the front-end designed in react. With flask you can also choose to forgo using react and opt for a simpler design. See the webpage for some simple recipes to build a quick and easy web app.
pip3 install flask
After completing these installation steps you should be on a great trajectory to optimize python's use to crunch data and develop basic web applications using flask and react. Although the combination of applications listed in this article are working well for me thus far, I encourage you to examine the wide variety of build combinations available before committing to this (or any other) build sequence.
Till next time!