User Tools

Site Tools


Sidebar



osx

Table of Contents

Mac OSX

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 "

SDL on OSX

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

file
otool
gobjdump
...

Folder/File sync tools

  • DeltaWalker
  • Singlemizer (not tested yet)

keyboard repeat rate / speed

defaults write NSGlobalDomain KeyRepeat -int 0

try 0, 1 or 2: the lower the faster

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)

thumbsup

een handige tool om snel afbeeldingen te bewerken

alternative to spotlight

get ip address

ipconfig getifaddr en1

or

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

convert png to ico

convert file.png file.ico

osx keyboard shortcuts

cls

clear

show contents of clipboard

pbpaste
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

or

drutil tray eject

dig

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-

or

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
ln -s fullpath-source-www /Users/rick/Sites/8

show display settings

alt+F2

QuickLook / Quick Preview / Syntax Highlighting / Color Code

Download QLColorCode. Create folder ~/Library/QuickLook and copy QLColorCode.qlgenerator to that folder.

SetFile

SetFile

dmg create command line

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 192.168.1.255

using arp to find mac address

ping IPADDRESS
arp -a

fping range

sudo fping -s -g 192.168.0.1 192.168.0.9 -r 1
fping -ag 192.168.1.0/24

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

stop cups

sudo launchctl stop org.cups.cupsd

40 lion tips

write disk image to sd card

diskutil list
diskutil unmountDisk /dev/disk3
dd if=debian6-19-04-2012.img of=/dev/disk3 bs=1m

(…additional “bs” parameter to “1m”? This parameter is used to set both the input and output block size for the copy)

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

tftp

- er is standaard een tftp client geinstalleerd
- een prima tftp server is TftpServer

Some dynamic linker tools that will come in handy

otool -L
install_name_tool
libtool

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

<code>
export CFLAGS=“-i /usr/local/include/libusb-1.0” </code>

disable OSX Lion remember open documents

see this or 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

/etc/paths

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);
CFRelease(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

stty

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

otool -L libopenFrameworks.dylib
install_name_tool

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>
#else
#include <GL/glut.h>
#endif

Enable colors in the terminal's ls command

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

export CLICOLOR=1

Show hidden files/folders

defaults write com.apple.finder AppleShowAllFiles TRUE

(and reload Finder)

Change screenshots folder

defaults write com.apple.screencapture location /Users/rick/Desktop/screenshots

SizeUp

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.

Visor

Install 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

~/.profile

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

Wireshark is a tool to analyze network traffic

hexdump

installed by default.

hexdump filename

sneltoetsen in nano console editor

zie nano

gmail berichten sturen via command line in osx

See this page: 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

Pleasant3D.app

Handige app om GCODES mee te bekijken in 3D

Synergy2

synergys --config synergy.conf

synergy.conf:

section: screens
        rick.local:
        User-PC:
end
section: links
rick.local:
        right = User-PC
User-PC:
        left = rick.local
end
osx.txt · Last modified: 2014/11/24 09:40 by rick