launchctl as alternative for ps

launchctl list | grep couchdb


You can burn ISO's with Etcher: https://etcher.io

custom resolution

"To access all supported resolutions for your external display, press and hold the Option key on your keyboard and then click the “Scaled” option again."

Prepare Mac for standalone exhibition


SD Memory Card Formatter for Mac


MediaKit reports not enough space on device for requested operation

This worked for me: (watch out: it formats the disk! make sure to select the right disk)

diskutil list
diskutil unmountDisk force disk2
sudo dd if=/dev/zero of=/dev/rdisk2 bs=1024 count=1024
diskutil partitionDisk disk2 GPT JHFS+ "LABEL" 0g


disk usage visualisation

  • grandperspective (works well)
  • disk inventory x (not tried yet)

my updated .bash_profile

export PATH=~/bin:$PATH
alias d="ls -lGa"
alias ls="ls -G"
alias untar="tar xvzf "
alias lsr="ls -ltr"  #recent files ordered ascending

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

. /usr/local/etc/profile.d/z.sh

git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
LOCATION='\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1...\2#g"`'
BRANCH=' \]$(git_branch)\[\]
\$ '

z as alternative for cd

brew install z
# add this to ~/.bash_profile: . /usr/local/etc/profile.d/z.sh


Make automatic screenshots


vardate=$(date +%Y\-%m\-%d); 
vartime=$(date +%H.%M.%S);
mkdir -p $folder
screencapture -t png -x $folder/$vartime.png;

or add screenshot directly to mjpeg file:

folder=$(dirname "$0")
vardate=$(date +%Y\-%m\-%d); 

screencapture -t tif -x /tmp/tmp.tif
/usr/local/bin/ffmpeg -i /tmp/tmp.tif -y /tmp/tmp.mjpeg
cat /tmp/tmp.mjpeg >> $folder/$vardate.mjpeg

#OCR text
echo ------------------------------------------------------ >> $txt
echo $vardate $vartime                                      >> $txt
echo ------------------------------------------------------ >> $txt
/usr/local/bin/pngtopnm /tmp/tmp.png | /usr/local/bin/ocrad >> $txt


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">






<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">


# launchctl unload nl.companje.screenshots.plist
launchctl load nl.companje.screenshots.plist
launchctl start nl.companje.screenshots
# tail /var/log/system.log


Run 3 minutes past midnight (or later when computer was a sleep at that time)


Use Automator for making Symbolic Links

1 Create an Application 2 add task Run Shell Script with 'pass input as arguments'

ln -s "$1" /Users/rick/Documents/Websites/


iTerm2 keyboard shortcuts and tips


convert multiple PNG's to JPG

You can do it with the Preview App as described here: http://osxdaily.com/2013/01/16/batch-image-conversion-mac-os-x-preview/

Kill Google Photo Uploader

(or anything containing the word 'Photos') kill -9 $(pgrep Photos)


recursive download van een website. http://www.sitesucker.us

mv command

by default it seems to replace a file. mv -n src dst # Do not overwrite an existing file. [[https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/mv.1.html|man]]

to enter unicode character on osx

  • System preferences-> input menu
  • check the box next to "Unicode hex".
  • add Unicode hex as a language
  • Switch to unicode input in the menu bar.
  • Hold Alt followed by a 4 digit hexadecimal unicode value to get the character.

chmod in Sites folder

chmod -R 755 folder_with_wrong_permissions


export PATH=/opt/local/bin:/opt/local/sbin:~/bin:$PATH

export ANDROID_HOME=~/Documents/android-sdk-macosx
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/20.0.0

export LUA_CPATH=/opt/local/share/luarocks/lib/lua/5.2/?.so
export LUA_PATH=/opt/local/share/luarocks/share/lua/5.2/?.lua

alias d="ls -lGa"
alias ls="ls -G"
alias um="cd ~/Sites/Ultimaker"
alias untar="tar xvzf "

if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
   . /opt/local/etc/profile.d/bash_completion.sh

list open ports

lsof -i -P | grep -i "listen"

my .bash_profile

export PATH=/opt/local/bin:/opt/local/sbin:~/bin:$PATH
alias d="ls -lGa"
alias ls="ls -G"
alias um="cd ~/Sites/Ultimaker"
alias untar="tar xvzf "


own /usr/local

chown -R rick /usr/local

convert DDS file to JPG on Mac OSX

busybox (shell & httpd)


dumb AP


diskutil on command line

diskutil list

file info


Folder/File sync tools

  • DeltaWalker
  • Singlemizer (not tested yet)

keyboard repeat rate / speed

unpack a .pkg file

batch resize images

sips -Z 640 *.jpg

serial communication with screen

screen /dev/[device name] 115200

To quit screen, press CTRL-a, followed by CTRL-k, followed by y.

follow system log

tail -f /private/var/log/system.log

macports / python

To make python 2.7 the default (i.e. the version you get when you run 'python'), please run:

sudo port select --set python python27

mount ssh folders

PVR QuickLook plugin

delete 'bands' files in Time Capsule .sparsebundle folder

Removing your Time Capsule .sparsebundle can take multiple days (or weeks) if you use Finder or Terminal. The fastest way is by connecting to the TimeCapsule through Windows running in Parallels/VMWare etc and delete it using Windows Explorer (\ipadress of time capsule). It took 'only' 80 minutes to remove 1.5TB (1.8 million files of 8MB)


een handige tool om snel afbeeldingen te bewerken

alternative to spotlight

get ip address

ifconfig getifaddr en1


ifconfig en1 | grep "inet " | cut -d " " -f2

convert png to ico (imagemagick)

convert file.png file.ico

osx keyboard shortcuts



show contents of clipboard

pbpaste | head -n 5

copy text to clipboard

ls | pbcopy

Convert tabs to spaces for the lines in the Clipboard

pbpaste | expand | pbcopy

sorting etc

ls | sort
ls | rev
ls | uniq
ls | uniq -d
ls | uniq -u

eject cd

diskutil eject disk1


drutil tray eject


dig companje.nl A

disable dashboard

defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock

get name of current wifi network

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I|grep " SSID: "|cut -c 18-


networksetup -getairportnetwork en1
networksetup -getairportnetwork en1 | cut -c 24-

airdrop info

restart Finder

killall Finder

list all network hardware ports

networksetup -listallhardwareports

get info about current wifi point

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --getinfo

scan for wifi points

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s

symbolic links

ln -s fullpath-source-www /Users/rick/Sites/8

show display settings


QuickLook / Quick Preview / Syntax Highlighting / Color Code

Download [[http://qlcolorcode.googlecode.com/files/QLColorCode-2.0.2.tgz|QLColorCode]]. Create folder ''~/Library/QuickLook'' and copy QLColorCode.qlgenerator to that folder.



dmg create command line

hdiutil create ....

usb device info

system_profiler SPUSBDataType

network utilities

  • From the Applications folder, open the Utilities folder, and then open the Network Utility application.
  • In the Network Utility window, click the Ping tab.

broadcast ping

ping -i 5 -c 2

using arp to find mac address

arp -a

fping range

sudo fping -s -g -r 1
fping -ag

websharing is removed from Mountain Lion Preferences but still usable

sudo apachectl start

Repeatable crash of Time Capsule wifi

Mac OSX Driver for Sweex Graphics Tablet USB TA006

serial terminal app

CoolTerm - http://www.macupdate.com/app/mac/31352/coolterm/

stop cups

sudo launchctl stop org.cups.cupsd

40 lion tips

write disk image to sd card

jhbuild bootstrap --ignore-system

geen idee wat het doet maar het doet iets.

network dump

only loopback traffic: ''tcpdump -i lo0 -vv''
\ en0 ethernet, en1 wifi


Some dynamic linker tools that will come in handy

otool -L

[[http://qin.laya.com/tech_coding_help/dylib_linking.html]] otool is an alternative for linux' 'ldd'

List files in library

ar -t libctest.a

Tijdelijk een header search path toevoegen via CFLAGS

``` export CFLAGS="-i /usr/local/include/libusb-1.0"

# disable OSX Lion remember open documents
see [[http://www.macworld.com/article/1161330/four_lion_terminal_hacks.html|this]] or [[http://reviews.cnet.com/8301-13727_7-20083707-263/managing-mac-os-x-lions-application-resume-feature/|this]]

for Preview, Quicktime and XCode:
defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false
defaults write com.apple.dt.Xcode NSQuitAlwaysKeepsWindows -bool false


this file contains the search paths

goto home dir

instead of ''cd ~'' you can just type ''cd''

move mouse with code

CGPoint pt;
pt.x = x;
pt.y = y;
CGEventRef mouseDownEv = CGEventCreateMouseEvent (NULL,kCGEventMouseMoved,pt,kCGMouseButtonLeft);
CGEventPost(kCGHIDEventTap, mouseDownEv);

spoof your MAC address

sudo ifconfig en1 ether aa:bb:cc:dd:ee:ff

to check the result type:

ifconfig en1 | grep ether

for Lion you might need to change ether into Wi-Fi. When you reboot your computer the original address is restored.

escape character in tenet on osx

Escape character is '^]'

which means Ctrl+]

hosts file

sudo nano -w /etc/hosts
sudo dscacheutil -cachedump -entries Host
dscacheutil -flushcache


http://stackoverflow.com/questions/3918032/bash-serial-i-o-and-arduino can you run stty -a < /dev/tty.usbserial-A800eIUj while you have the serial port working on the Arduino IDE? That would give you the settings to use.

stty -f /dev/tty.PL2303-00001004 19200


otool -L libopenFrameworks.dylib

automatisch opstarten

nog uitzoeken: launchd en lingon

launch application by keyboard shortcut


swap alt+windows key on external keyboard

searching in files recursively

grep -ir "texttofind" *

using the find command on the command line

find . | grep -i ".cpp"

use grep to search output of a program

git diff | grep 'piano'

compile a simple glut program written in c on mac

g++ -Wall -O3 -g -framework OpenGL -framework GLUT bezmesh.c -o bezmesh

Don't forget to include OpenGL and GLUT like this:

#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#include <GLUT/glut.h>
#include <GL/glut.h>

Enable colors in the terminal's ls command

or type ''ls -G'' or put the following in your ''~/.profile'' file for a permanent solution.

bashexport CLICOLOR=1

Show hidden files/folders

defaults write com.apple.finder AppleShowAllFiles TRUE

(and reload Finder)

Change screenshots folder (and other settings)


[[http://www.irradiatedsoftware.com|SizeUp]] allows you to quickly position a window to fill exactly half the screen (splitscreen), a quarter of the screen (quadrant), full screen, or centered via the menu bar or configurable system-wide shortcuts (hotkeys). Similar to "tiled windows" functionality available on other operating systems.


Install [[http://visor.binaryage.com/|Visor]] to have a system-wide terminal on a hot-key.

Rotate an image

sips input.jpg -r 90 --out output.jpg

convert an image

sips -s format jpeg 4.gif --out 4.jpg

chmod recursive write access

chmod -R 777 data


on osx 10.9 I had to rename .profile to . bash_profile

alias dir="ls -lGa"
alias tocaf="afconvert -f caff -d LEI16"
alias cdd="cd ~/Desktop"

ffmpeg for converting movie to iPad

see [[:ffmpeg]]

combine pdf's on mac osx (with pdftk)

sudo port install pdftk
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

homebrew (brew)

An alternative for macports


Wireshark is a tool to analyze network traffic


installed by default.

hexdump filename

gmail berichten sturen via command line in osx

See this page: [[http://www.amirwatad.com/blog/archives/2009/03/21/send-email-from-the-command-line-using-gmail-account/|link]] I managed to send an email but it's not working completely yet.

terminal / iTerm2

  • Cmd+[ ] move between panels
  • Cmd+D new panel
  • Cmd+W close panel
  • ^A naar begin regel


Handige app om GCODES mee te bekijken in 3D


synergys --config synergy.conf


section: screens
section: links
        right = User-PC
        left = rick.local