Skip to content

Instantly share code, notes, and snippets.

@gavinmcfarland
Last active May 20, 2024 03:01
Show Gist options
  • Save gavinmcfarland/6253998 to your computer and use it in GitHub Desktop.
Save gavinmcfarland/6253998 to your computer and use it in GitHub Desktop.
My Local Development Setup
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

To setup my local machine for developing I do the following.

  1. Install Xcode
  2. Install developer tools
  3. Create SSH key
  4. Add SSH to github
  5. Install brew
  6. Install code VScode ⌘ + ⇧ + P and then findShell Command: Install 'code' command in PATH command
  7. Install node
  8. Install nvm
  9. Install gh cli
  10. $PATH /opt/homebrew/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Library/Apple/usr/bin

Install macOS updates

Download Xcode

Go to app store and download Xcode Open Xcode and go to Open Developer Tools > More Developer Tools and download most recent Command Line Tools. Or you can run xcode-select --install, must open Xcode once first.

https://developer.apple.com/xcode/

Fish

Install using dmg package.

Setup Apache

Just use

sudo apachectl start

Create the folder /Users/[username]/Sites/.

Create /etc/apache2/users/[username].conf file with contents

<Directory "/Users/[username]/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>

Replace [username] with your username.

Set permissions -rw-r--r-- 1 root wheel 298 Jun 28 16:47 username.conf

sudo chmod 644 username.conf

Uncomment following lines in /etc/apache2/httpd.conf file

LoadModule userdir_module libexec/apache2/mod_userdir.so
...
LoadModule include_module libexec/apache2/mod_include.so
...
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
...
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
...
LoadModule authz_core_module libexec/apache2/mod_authz_core.so


Include /private/etc/apache2/extra/httpd-userdir.conf

Uncomment line in /etc/apache2/extra/httpd-userdir.conf

Include /private/etc/apache2/users/*.conf

Run sudo apachectl restart to restart Apache and make sure there are no errors

Should be able to visit localhost and localhost/~[username] now.

Install PHP

Script I used which is from http://php-osx.liip.ch/. Installs it to /usr/local/php5.

Uncomment timezone and lattitude in php ini file to Europe/London /usr/local/php5/php.d/99-liip-developer.ini

Need to add export PATH=/usr/local/php5/bin:$PATH to .profile file for command line to pick up latest version of php

Test it by creating phpinfo.php file with <?php phpinfo(); ?>

Install MySQL

Installed MYSQL from mysql website. Under MySQL Community. Makes sure 64bit.

https://dev.mysql.com/downloads/mysql/

Downloaded Sequel Pro. Connected to local mysql using socket.

Add /usr/local/mysql/bin to PATH

Node.js

Download node installer from website. Run installer. Make sure /usr/local/bin is in $PATH. Check $PATH using echo $PATH

NVM

Google and install using:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Fish Bash

Needed for NVM

https://eshlox.net/2019/01/27/how-to-use-nvm-with-fish-shell

Bash Profiles

Need to create .bash_profile in home directory and add export export PATH=/usr/local/php5/bin:$PATH for command line to pickup latest version of php. Add /usr/local/mysql/bin to PATH also.

VSCode path

Launching VS Code from the terminal looks cool. To do this, press CMD + SHIFT + P, type shell command and select Install code command in path. Afterwards, navigate to any project from the terminal and type code .from the directory to launch the project using VS Code.

Upgrade Git

Add SSH key. Follow Githubs help.

https://stackoverflow.com/questions/8957862/how-to-upgrade-git-to-latest-version-on-macos#:~:text=Click%20on%20Advanced%20tab%20%E2%86%92,give%20you%20the%20latest%20version.

Extras

Added Github Issues command line interface Install fish shell.

Yoeman

Run npm install -g yo grunt-cli bower in terminal. May require sudo. grunt-cli bower are not required for latest version of npm as npm will automatically install them.

Bower

Install bower

Quartz

Download install from https://xquartz.macosforge.org/landing/

Java Developer Tools

Download form apple developer website.

Homebrew

Install from webiste.

Coffee Script

npm install -g coffee-script

Install from webiste.

Composure for PHP

Install following directions on website

Then add

<?php require 'vendor/autoload.php'; ?>

To you're project.

Install SASS

gem install sass

To create custom function create file in gem folder and require it into main sass module.

Shell/Prompt

Check path of zsh shell which comes with mac which zsh

Create zsh profile touch ~/.zshrc

Change from bash to zsh chsh -s /bin/zsh

Fish like command syntax highlighting https://github.com/zsh-users/zsh-syntax-highlighting

Install using brew install zsh-syntax-highlighting

Simple/minimal terminal https://hyper.is/ Change preferences to point to zsh shell /bin/zsh

Hyper snazzy theme hyper install hyper-snazzy

Vagrant

Install Vagrant using installer.

Install VirtualBox

Download project and run environment

NPM

You need to login by adding the user to the system/terminal.

npm adduser

To publish a package you need to first publish using native npm

npm publish

If you're publishing a scoped package in an organisation, which is not private you need to include the flag --access public

npm publish --access public

VS Code

I had an issue pushing to github. I found I had to:

  1. search for git.terminalAuthentication in VS code settings.
  2. Disable it
  3. Reload VScode
  4. Enable it again
  5. Run push command to setup new repo
  6. Then it prompted me to login via website
function nvm
if not type -q bass
echo 'Bass is not installed please install it running fisher edc/bass'
return
end
set -q NVM_DIR; or set -gx NVM_DIR ~/.nvm
set -q nvm_prefix; or set -gx nvm_prefix $NVM_DIR
bass source $nvm_prefix/nvm.sh --no-use ';' nvm $argv
set bstatus $status
if test $bstatus -gt 0
return $bstatus
end
if test (count $argv) -lt 1
return 0
end
if test $argv[1] = "use"; or test $argv[1] = "install"
set -g NVM_HAS_RUN 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment