When a mac developer codes on a Windows...
- Ubuntu - Linux Subsystem on Window (WSL)
- Oh My ZSH
- Spaceship Prompt - with minimalist ui
- Hyper.js Terminal - for tabs and styling
- Node.js and n for version management
- git
- login with encrypted
.netrc
- sign commits by default
- login with encrypted
-
Enable feature. Inside Powershell (right click windows symbol), type:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
-
Install Ubuntu from Windows App Store. Note: you will be prompted to create a separate user and password for the linux subsystem.
-
Update Ubuntu - install latest versions of dependencies, etc.
sudo apt update sudo apt upgrade
-
Install essential developer tools incl. gcc and make, which are required later.
sudo apt install build-essential
-
Install git
sudo apt install git
-
Install Node Version Manager
We will use n to manage versions of node.js. To install, we need to run:
curl -L https://git.io/n-install | bash
Note: this may fail if
build-essential
tools are not installed in previous step. -
Install latest Node.js LTS version:
n lts
-
Check everything works:
npm --version node --version
If it doesn't check that
~/n/bin
is in your$PATH
.
- Install Oh My ZSH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- Install the Hyper.js Terminal
- Install Powerline Fonts per these instructions:
- Download fonts from github.com/powerline/fonts and navigate to the folder in Powershell.
- Inside Powershell:
Set-ExecutionPolicy Bypass
- Run
.\install.ps1
to install all fonts at once. Might take a few minutes - Inside Powershell:
Set-ExecutionPolicy Default
- Install Spaceship prompt
npm install -g spaceship-prompt
Open the Hyper app. Then open up preferences via the Hamburger menu or by pressing Ctrl
+ ,
(comma)
Copy the contents of the .hyper.js file in this repository, which changes the shell to C:\\Windows\\System32\\bash.exe
and adds the following plugins
- verminal color scheme
- hyper-tabs-enhanced
- hyper-hide-scroll
The other customizations are cosmetic.
Note: Hyper.js is not installed in your linux home, but rather at your Windows home: /mnt/c/Users/<username>
Copy these files into your home directory, aka ~
, which should be /home/<username>
:
- .bash_aliases
- .zshrc, which also configures spaceship prompt
- .gitconfig
-
Create
.netrc
Inside your
~
home directory, create a.netrc
file with the following contents (password is plain text):machine github.com login <USERNAME> Password <PASSWORD>
-
Generate GPG Key
gpg --gen-key
which will prompt you for name, email and secret.
-
Encrypt
.netrc
Now encrypt it using the gpg key, where
<EMAIL>
is the address you used when creating the keygpg -e -r <EMAIL> ~/.netrc
-
Add credential Helper
Inside your
~
home folder, create a new foldermkdir ~/bin
and then download the credential helper:
curl -o ~/bin/git-credential-netrc https://raw.githubusercontent.com/git/git/master/contrib/credential/netrc/git-credential-netrc
give it executable permissions:
chmod 755 ~/bin/git-credential-netrc
Verify the following is in your
.zshrc
:export PATH=$HOME/bin:$PATH export GPG_TTY=$(tty)
-
Configure git to use credential helper
git config --global credential.helper "netrc -f ~/.netrc.gpg -v"
-
Configure git to automatically sign commits
git config --global commit.gpgsign true
For details about adding the public key to your GitHub.com profile, see: