Mac: Copy the current SVN URL to the clipboard from command line

If you are still using SVN (WHY HAVEN’T YOU SWITCHED TO GIT??), here’s a simple alias you can drop into your ~/.bash_profile . Then type `source ~/.bash_profile` on any current terminal windows to load the alias. Here’s how it works. Navigate to your SVN working copy and type `svnurl` and viola! it’s copied to your clipboard. This is extremely useful for copying/deleting/switching/merging branches via command line.

Setting Proper WordPress Unix Permissions

One of the biggest black boxes of WordPress for newbies is file ownership/permissions. I’ve had numerous people ask me why they can’t use the default theme editor or install new plugins directly from wp-admin. The symptoms usually range from getting the FTP credentials screen to error messages that WordPress cannot create a specific directory, and more.

It took me a while to grasp the concept, so I hope the following explanation will help you. This, in no way, is a security tutorial. It is a simple tutorial on Unix users/groups and file permissions. You should also read Hardening WordPress. If you’re not sure about file permissions, read this article first.

Automatic git status emails

This is a basic, elementary script to audit a git working copy. This is useful to keep a watchful eye on cowboy coding on a client server.

Save the following inside your git repo as Make sure to add ‘’ to your .gitignore file.

MODIFICATIONS=`git status -s`
if [ ! -z "$MODIFICATIONS" ]
        SUBJECT = "git changes from $DOMAIN"
        EMAIL = "$SENDTO"
        BODY = "/tmp/emailbody.txt"
        echo "Changes found on the following paths:\n" > $EMAILBODY
        mail -s "$SUBJECT" "$EMAIL" < $EMAILBODY
        echo "$MODIFICATIONS"

To automate, add a crontab:
30 15 * * * /path/to/your/script/ 2>&1>> /dev/null


Restart the Mac VPN Service via Command Line

If your VPN connection is ever disrupted and you cannot reconnect, don’t restart your computer. Open up a shell window and use the following commands to stop/start the native VPN service.

sudo launchctl stop
sudo launchctl start 

Uploading folders via Terminal

There are times when I want to upload a chunk of files without logging into (S)FTP. If you’re on a Mac it’s a simple command that will upload everything in a specified folder.



scp -r ~/Desktop/folder/