• Stars
    star
    213
  • Rank 185,410 (Top 4 %)
  • Language
  • Created over 9 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The perfect web development OS X setup

The Perfect Web Development Setup for OS X / macOS

This is what I perceive as the perfect web development OS X setup for JavaScript engineers.

Goals

  • Never use sudo. Once you run a command with sudo, future commands are probably gonna be fucked up as well.
  • Automatically start all services. Don't bother keeping track a bunch of terminals running processes.
  • Don't shoot yourself in the foot.

Environment Profile

The new default shell in macOS is zsh. Create and update your profile at ~/.zshrc. You may also want to brew install zsh-completions zsh-autosuggestions.

XCode Command Line Tools

First, you need to install XCode's command line tools. This installs a lot of tools like git which aren't needed for plebeians.

xcode-select --install

If you're on Apple Silicon, you may want to install Rosetta 2:

softwareupdate --install-rosetta

Install Homebrew

Homebrew is a macOS package manager that makes setting up all your services very easy.

Install everything

Install everything with Homebrew. Here are some packages you might be interested in right now:

# for editing files
brew install vim
# always keep your git up to date by installing it with brew
brew install git
# download stuff
brew install curl

Updating

To update your packages, simply run:

brew update
brew upgrade
brew cleanup

Install node.js with nvm

One thing many users do is install node.js globally. This is easy to get started or fine for servers, but it makes developing a pain. If you have to ever run npm with sudo, you're doing it wrong!

nvm is what I think is the best node version manager. It can be installed with homebrew! Yes, you use a package manager to install a version manager to install another package manager. It's stupid, but they all have their strengths.

brew install nvm

Then, follow the installation instructions:

brew info nvm

Then, set a default version of node.js. To use LTS:

nvm alias default lts/*

Default node.js version via .nvmrc

The .nvmrc route of selecting the version of node to use is helpful when you are working on multiple projects with different versions of node. Create a ~/.nvmrc file with a version of node you'd like to use or, for LTS versions, lts/*:

echo "lts/*" > ~/.nvmrc

Then install that version of node:

nvm install

Note that you should run nvm install once in a while to get an updated version of node.

Then in your ~/.zshrc, add the following line to always use the version of node the current working directory expects:

nvm use
# or `nvm install`, which is slower, but will always install the latest version of node

Now, nvm will find the nearest .nvmrc file and use that version of node whenever the terminal starts.

Using npm

With nvm, you should never be calling any npm functions with sudo. nvm adds binaries installed globally to your $PATH, so if you install npm i -g create-react-app, create-react-app will automatically be added to your $PATH.

To upgrade npm, run npm -i -g npm.

To have node binaries install faster, add the following to your ~/.nvmrc:

export NPM_CONFIG_JOBS=max

If you hate the npm progress bar like, add this to your zshrc:

export NPM_CONFIG_PROGRESS=false

Speed up node.js

node.js has by default 4 thread pools via libuv regardless of how many CPUs you have. If you have more CPUs and depending on what you're running locally, you may find a performance benefit in increasing this number.

export UV_THREADPOOL_SIZE=8

vim

Homebrew's default version of vim doesn't allowing copying and supports the mouse, which IMO defeats the purpose of vim. Here's a basic ~/.vimrc to fix that:

set mouse=
syntax on

thefuck?

thefuck is a nifty tool that allows you to fix your previous CLI typos by just typing fuck. It perhaps has the greatest UX of all products, ever.

Installing it is easy:

brew install thefuck

Then follow the instructions:

brew info thefuck

Setting up databases

Homebrew makes setting up databases super easy. First step - install it with Homebrew:

brew install redis

Then you'll see information on your terminal like the following:

To have launchd start redis now and restart at login:
  brew services start redis

To read this information again, just type brew info redis. Run the command and, Voila! redis-server will always be running! You won't have to open a bunch of terminals to keep it running!

Rinse and repeat for all your databases.

git & GitHub

You may want to set up a few configs.

Always fast-forward when pulling (never rebase as it may mess up your local branch):

git config --global pull.ff only 

Tools & Applications

More Repositories

1

heroku-buildpack-ffmpeg-latest

A Heroku buildpack for ffmpeg that always downloads the latest static build
Shell
360
star
2

horizontal-grid-packing

Horizontal grid packing
JavaScript
130
star
3

git-style-guide

Personal guide for using git with GitHub
74
star
4

style-guide

My style guide
64
star
5

ee-first

return the first event in a set of ee/event pairs
JavaScript
54
star
6

server-style-guide

Style guide for writing JS web servers
35
star
7

async-control-flow

Workshop on Asynchronous Control Flow
JavaScript
28
star
8

baaar

a colorful top loading progress bar
JavaScript
24
star
9

js-style-guide

My style guide for JS
22
star
10

ci-workshop

My workshop on CI
21
star
11

autocomplete

mobile-first autocomplete
JavaScript
17
star
12

pipe

Streaming and async template rendering for node.js using template strings
JavaScript
13
star
13

babel-nodepack

A babel bundler for node.js
JavaScript
10
star
14

react-asset-loader

React Asset Loader
JavaScript
10
star
15

fn-getter

Simple, lazyily evaluated values
JavaScript
9
star
16

ims

A basic Image Management System for managing your assets
JavaScript
9
star
17

module-style-guide

Style guide for writing JS modules
8
star
18

lazyrequire

lazily require modules in node.js
JavaScript
7
star
19

gh-automerge

Deprecated: superseded by native auto-merge and https://github.com/jonathanong/dependabot-automerge
JavaScript
7
star
20

component-style-guide

Style guide for authoring (web) components
7
star
21

memorizer

memoize a getter of an object
JavaScript
6
star
22

lru-cache-decorator

lru-cache as a decorator function
JavaScript
5
star
23

bulk-insert

A writable stream that batches
JavaScript
5
star
24

no-naughty-words

Censor bad words
JavaScript
5
star
25

textcomplete

textcomplete
JavaScript
5
star
26

s3-set-headers

Update headers on all objects in a bucket
JavaScript
5
star
27

npm-pin-dependencies

Pin all your npm dependencies
JavaScript
5
star
28

redis-cache-fn

cache a function via redis
JavaScript
5
star
29

path-is

check what type of path a string is
JavaScript
4
star
30

asymmetrical-signing

Asymmetrically sign any data
JavaScript
4
star
31

rpit

[DEPRECATED] personal repository initialization thing, will be replaced by something better!
JavaScript
4
star
32

passwords

Password creation and management with native scrypt and haveibeenpwned
JavaScript
4
star
33

github-actions-workflow-templates

Templates for GitHub Actions
JavaScript
4
star
34

fn-key-cache

JavaScript
3
star
35

spdy-keys

SSL keys for development use
JavaScript
3
star
36

file-is

Check the type of a file or buffer by inspecting its contents
JavaScript
3
star
37

load-script

Script loader with promise & requestIdleCallback support
JavaScript
3
star
38

json-check

JSON file checker
JavaScript
2
star
39

dependabot-automerge

JavaScript
2
star
40

delegated-dropdown

mobile-first delegated dropdown menus with smart positioning
JavaScript
2
star
41

redis-cache-decorator

DEPRECATED
JavaScript
2
star
42

redshift-loader

JavaScript
2
star
43

crappy-recruiters

A list of spammy recruiters in the Los Angeles area
2
star
44

greenkeeper-enable-organization

Enable greenkeeper on all of an organization's repositories
JavaScript
1
star
45

identify

Image identification service with Vips via Sharp support falling back to ImageMagick
JavaScript
1
star
46

disallow

Disallow certain types of files
JavaScript
1
star
47

ci-reference-app

JavaScript
1
star
48

async-local-storage-read-replica

JavaScript
1
star
49

jonathanong

1
star
50

ci-reference-app-2

JavaScript
1
star