Skip to content

Setup a new Mac for Development

Matthew Gramigna edited this page May 3, 2019 · 1 revision

This guide will go through everything worth installing to start developing locally on a Mac for Flux Notes. It assumes that nothing is installed prior to reading this guide

Installations

Google Chrome

We use Chrome as our primary browser for Flux Notes. Install from here

iTerm2

iTerm2 is cooler than the regular "Terminal" app that comes with Macs. Download it here

VS Code

This is the text editor that we use for Flux Notes. It has useful extensions that make development a lot easier. You can install it directly from the website.

Homebrew

Homebrew is a package manager for Macs that can be used to install different things onto your machine from the terminal.

  1. Open up iTerm2
  2. Homebrew requires that the xcode command line tools be installed. Run the following command in the terminal:
xcode-select install
  1. Install by copying and pasting the installation command from this site into the terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Make sure everything worked by running the doctor command for homebrew in the terminal:
brew doctor

Git

Git is what we use for version control in Flux Notes. Git might come pre-loaded on Macs, but the version could be out of date, so install Git with Homebrew in the terminal:

brew install git

Tell git who you are but using the git config command in the terminal:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Node.js

Node.js is required to run the Flux Notes application in the browser. Our recommended version is v10.14.1 currently. We can install this using nvm (Node Version Manager). It's useful to install it this way instead of through Homebrew so you can switch versions easily later if we need to.

  1. Paste the following install script from nvm into your terminal:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
  1. Ensure that it was correctly installed with this command:
command -v nvm
  1. Install node using nvm:
nvm install 10.14.1
  1. Ensure that both node.js and npm (node package manager) were installed correctly:
node --version
npm --version

Yarn

We use Yarn to control our packages in Flux Notes. It is essentially a wrapper of npm that ensures the locking of package versions via a lockfile. It can be installed using Homebrew:

brew install yarn

Ensure that it was installed correctly by checking the version:

yarn --version

GitHub

All of the code for Flux Notes is located on our GitHub Repository. If you don't already have a GitHub account, you can create one for free.

Set up an SSH Key

I recommend using an SSH key in GitHub. This will prevent you from having to enter your username and password in the terminal every time you try to read or write code on your local machine with respect to the remote Flux Notes repository

  1. In the terminal, run the following command:
ssh-keygen -t rsa
  1. It will prompt you for some information, including a passphrase and stuff. You can leave these things blank, so just keep hitting enter until the keypair is generated
  2. View the contents of the public key by running the following command in the terminal:
cat ~/.ssh/id_rsa.pub

This should print out something that looks like this:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA ... (more random letters and numbers) ...
  1. Copy all of this to your clipboard (including the ssh-rsa part)
  2. Ensure that you are logged in to GitHub in the browser using the account you just created
  3. In GitHub in the browser, click on the rightmost icon in the top right and select "Settings"
  4. From the menu on the left side, click on "SSH and GPG Keys"
  5. Cick the green "New SSH key" button
  6. Name it whatever you want, like "MITRE laptop" or something, and paste the contents of the public key that you copied from the terminal (the part that begins with "ssh-rsa") into the box under the word "Key"
  7. Click "Add SSH Key"

Installing and Running Flux Notes

You should now have everything setup that you need to start developing on Flux Notes. To get the code up and running:

  1. Clone the repository in the terminal:
cd ~
mkdir Projects
cd Projects
git clone [email protected]:FluxNotes/flux.git

This should get the code on your machine

  1. Go into the newly created "flux" directory and install the dependencies:
cd flux
yarn install

This might take a minute or 2 to install everything

  1. Start the local server:
yarn start

Flux Notes should now be running in the browser. Go to http://localhost:3000/pilot1 and you should be able to view the app

Clone this wiki locally