Laptop Keyboard missing keys
Mac laptop Win/Linux full size keyboard
Fn UpArrow PgUp
Fn DownArrow PdDw
Fn LeftArrow Home
Fn RightArrow End
Fn backspace Del # works in vi
^D Del # does NOT work in vi!
?? Ins # No way to emulate an insert key on the laptop :( :( :(
Keyboard shortcuts when running Mint
Mac Win/Linux Action
^ Fn+UpArrow ^PgUp previous tab in mate-terminal
keyboard shortcuts from apple support
Some less intuitive keyboard binding from a windoze/linux user perspective:
Cmd/Command = Windows key = Apple key
Option = Alt
Control = ^
Cmd-Tab Switch apps: Switch to the next most recently used app among your open apps.
Cmd-` Switch windows w/in app, within SAME WORKSPACE (works in Terminal and firefox)
Cmd-Sh ~ (Cmd-Tilde) Switch windows: Switch to the next most recently used window of the front app.
Cmd-alt-Lf/Rg cycle thru tabs in chrome.
Cmd- Lf/Rg cycle thru windows in Terminal app, ACROSS workSpaces. Chrome "BACK" and "FWD" on page (URL) navigation.
ctrl-tab cycle thru tabs in Terminal app
Cmd-Sh-4 ( cmd-$) # cropping method. save to .png in desktop (10.12.5?)
Ctrl-Cmd-Sh-4 (^cmd-$) # cropping method. send to clipboard (no saving to file)
Cmd-Sh-3 # screenshot of the entire screen, save to .png on desktop.
Ctrl-Cmd-Sh-3 (^cmd-#) # screenshot of the entire screen, send to clipboard (no saving to file)
Cmd-, # Preferences: Open preferences for the front app.
^-Sh-Power/Eject # blank screen (lock after additional preset num of min)
Fn Power/Eject # bring up lock/sleep/power off menu (closest thing to Windows-L)
Mac Win/Linux,vi/bash? Action
----------------- --------- -------- -----------------------------------------------
Cmd-W ^W close tab/window
Cmd-Q Alt-F4 quit app
Text Editing/Document Navigation
Mac Win/Linux,vi/bash? Action
----------------- --------- -------- -----------------------------------------------
Alt-Lf/Rg ^Lf/Rg Word left/right, even in Terminal
Alt-Del/Bksp ^Del/Bksp Delete word
Alt-Up/Dn Hm/End v,b Begining/End of line
Cmd-Lf/Rg Hm/End Begining/End of line [official apple publish]
^A/E ^A/E Begining/End of line
Cmd-Up/Dn ^Hm/End Top/End of doc
Hm/End ^Hm/End Top/End of doc
^Lf/Rg SPACES (workspace) Left/Right
3finger swipe Lf/Rg SPACES (workspace) Left/Right
(Gnome3 use vertical stacked workspace and use mouse wheel to nagivate.
Editor keybind that will probably never use:
Control-L Center the cursor or selection in the visible area.
Control-O Insert a new line after the insertion point.
Control-T Swap the character behind the insertion point with the character in front of the insertion point.
These looks similar to bash shell prompt binding:
But could just use arrow keys. Maybe more useful in vi mode?
Control-F Move one character forward. LEFT ARROW
Control-B Move one character backward.
Control-P Move up one line. UP ARROW
Control-N Move down one line.
Terminal app keybindings
(probably add screenshots)
Cmd-Up/Dn Terminal navigate thru command history
mac win action
---------- ----- -----------------------------------------------
Ctrl+Alt+i Alt+i Insert menu (eg R to add Row, C to add column)
From server fault, can get mouse follow focus for just the terminal app.
only for Terminal app, not all app. But better than nothing!
Run this cmd in terminal, then restart:
defaults write com.apple.Terminal FocusFollowsMouse -boolean YES
Package managers for Mac OS/X
MacPort - formerly Darwin port
contain lot of "unix style" software packages.
install to /opt/local
fink = package manager like Ubuntu apt-get, oft used by users from Debian world.
need to be installed separately, create resource tree independent of mac os x, more unixy...
more cutting edge that Mac OS Port. May have pre-compiled binaries.
install to /sw
rudix = pre-compiled unix sw for OS X (Yosemite in progress, Maverick and older okay)
homebrew = http://brew.sh/
install to /usr/local, which is said why it works! changing path not recommended!
have not been able to get it to install/work behind a proxy :(
Said to depends more on mac os x native packages, more integrated, uses less space.
Intended audience = mac users.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/burn added a GUI Burn.app into Applications.
brew cask can manage and install mac native apps. (used by geerlingguy Ansible for DevOps).
nix = from NixOS, meant to be a declarative (stateless) package management.
package are build from source, but cached to provide performance close to traditional binary-based package manager.
Comarison discussion in Stack Exchange :: Ask Different
Homebrew is what I use in 2017
- Requirements: Java, Xcode
- Download installer and follow instructions from
sudo xcode-select --install
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
sudo xcodebuild -license
tar -xvf fink-0.41.1.tar.gz
# long build process...
You should now have a working Fink installation in '/sw'. You still need package descriptions if you want to compile packages yourself. You can get them
by installing the dists-10.12-0.16.0.tar.gz tarball, or by running either of the commands: 'fink selfupdate-rsync', to update via rsync (generally
preferred); or 'fink selfupdate-cvs', to update via CVS (more likely to work through a firewall). You should also run 'sudo xcodebuild -license' and
accept the Xcode license, since some packages will require this.
Run '. /sw/bin/init.sh' to set up this terminal session environment to use Fink. To make the software installed by Fink available in all of your future
terminal shells, add '. /sw/bin/init.sh' to the init script '.profile' or '.bash_profile' in your home directory. The program /sw/bin/pathsetup.sh can
help with this. Enjoy.
(info from finkproject)
Obsolete method to install Fink
No longer works? cuz fink group no longer building .dmg?
installer -pkg Fink*pkg -target LocalSystem
# similar to rpm -i sw.rpm
# -target LocalSystem is the equiv of the GUI telling where to put the program. Should be able to use / also.
pkgutil --pkgs # list packages installed on system (.pkg, not stuff that Fink install, which are .deb packages).
# os x command? but no longer avail in 10.12 ?
dmg are sw image that are "mounted", accessible from /Volumes.
Firefox can run off inside such mount.
Other apps req copying the files there to /Applications folder.
Yet other require an install from there.
# update fink db, support http_proxy env var if proxy need to be set.
fink list # list avail packages. no samba or smbclient.
# don't see if it provides anything that homebrew don't
# fink is prob no longer worth the trouble
fink install ...
dpkg --list # list debian packages (installed by fink)
With ~ 10.5, application-based firewall is the default firewall app (controlled by the GUI). It is a port of OpenBSD PF.
It is good for laptop user who control access to app in allowing remote connection. But it is not so great for a server-oriented firewall that may want to limit access by IP address range. In such cases, the old IPFW (derived from FreeBSD) is available from the CLI. IPFW actually takes precedence over PF; neither of them are on by default.
firewall from apple support 10.5+
guide on setting up ipfw
cli in Mac OS/X
smbutil view //samba-server # ~ smbclient -N -L //samba-server
# launchd is pid 1 for mac, so think of it as init/systemd of linux.
launchctl list # list services, think of systemctl list-unit-files
launchctl stop com.nomachine.localnxserver # like systemctl stop, should be a one time stop the nx service (but this one starts right back up)
launchctl remove # permanently remove service
launchctl load # said to load it back, but removed,
launchctl unload com.nomachine.localnxserver # did not work
# so, not sure what's the equiv of systemctl disable
sudo launchctl limit maxfiles unlimited # fix number of open file handles to unlimited (def is very low)
- The python that comes with OS X is quite old :( Sierra 10.12.6 comes with Python 2.7 which does not have PIP :(
- easy_install pip . Script comes with os x in /usr/bin, will try this first
- (Trying to install Ansible)
- brew install python/pip is possible, but then install a second python on system, and different way of calling things may end up using diff python
Getting new Mac to be useful
Below are example commands to make os x more hacker friendly, use cli to install .dmg., etc
wget -nc https://raw.githubusercontent.com/tin6150/psg/master/script/mac/installFavApp.sh -O installFavApp.sh
# should check that downloaded the right thing before running it. also, script use sudo.
bash -x installFavApp.sh
# install Vagrant .dmg
sudo hdiutil attach vagrant_2.0.0_x86_64.dmg
sudo installer -package /Volumes/Vagrant/vagrant.pkg -target /
# in this case, the app was installed to /opt/vagrant with link in /usr/local
sudo hdiutil detach /Volumes/Vagrant
# install Oracle VirtualBox
sudo hdiutil attach VirtualBox-5.1.28-117968-OSX.dmg
sudo installer -package /Volumes/VirtualBox/VirtualBox.pkg -target /
# installed to /Applications/VirtualBox.app
sudo hdiutil detach /Volumes/VirtualBox/
while booting up:
option = select OS to boot with (when bootcamp is configured)
apple+t = target firewire disk mode (or just press T key?)
apple+v = verbose mode (this time only)
apple+s = single user mode (but don't run fsck from here! boot from DVD for such action!) (or just s ?)
apple+r = reinstall
shift = Safe Boot mode - https://support.apple.com/en-us/HT201262
command+r = recovery mode (same as a the recovery choice when "option" key boot).
Permanently disable flashy non-useful boot screen (ie, verbose unix-like booting):
go to terminal, run
sudo nvram boot-args="-v"
To see current settings:
System Integrity Protection
csrutil disable # this can only be run in Recovery Mode's terminal
May not be trivial to migrate data from an old mac to a new one...
Backup and Prep
- Avoid upgrading OS when planning to migrate soonish down the road. (Direct machine restore tends to complain OS in destination host is older, not sure if build numbers are different or some bugs).
- Partition a new disk with GUID (Linux parted and mkfs.hfsplus didn't work). Use the mac disk utility.
- Install an OS on this external disk. Boot with Cmd-R, select external disk, install the OS on it.
- Run time machine backup to this disk (which is now bootable).
Restore Using Migration Assistant
- Start OS, login as normal.
- Run Migratin assistant (under App, Utilities). migrate data from time machine backup disk.
- The ugly part:
- Migrate only document data matching the user that is logged in and started the Migration assistant.
- if username doesn't match old computer, then nothing is transfered.
- Even if username match, didn't copy much. May need apple id match.
- But how to create such account? It is not like MS where you login directly using MS ID. *sigh* :(
- It reboot the machine, can't do anything while it migrates
Restore Using Migration Assistant
- Boot machine while holding Cmd-R
- Run Utility of Restore machine from time machine backup
- It will erase the destination computer hd.
- Did feel like it is a clone. Everything that was left in old computer now login and looks the same in new.
- One Notes and notebook open just fine. Hope it sync to web directly using a new sync id.
- git repos seems fine
- Did not migrate: Dropbox. Google drive
- Apple iCloud need to login, hanging.
- iTunes need new authorization as new computer
How many places are hostname set in the mac?? !@#!$%
sudo scutil --get Hostname # may not be set
sudo scutil --set Hostname jr12pro # affect cli "hostname"
sudo scutil --set LocalHostName jr12.local # bonjour hostname (GUI Settings, Sharing, hostname)
sudo scutil --set ComputerName "descriptive name" # optional
dscacheutil -flushcache # flush dns
Older mac stuff
cmd key is the apple key
option = alt
ctrl = control (^)
cmd+tab = similar to windoze alt+tab
boot, option key = boot current os
boot, c = boot from cd
apple + control + power = reboot
Enable unix mode boot:
While booting, enter cmd+opt+O-F
This will cause machine to boot like sun machines.
switching between XDarwin X session and Aqua:
(10.5, they can coexist together)
NIS info from
OS X can act as NIS server.
yp files are in /var/yp
init rc file (?) at
OS X NIS client.
Some minimal info in lookupd.
Leopard 10.5 has NIS client build-in. Just need to specify NIS domain and servers.
NFS mount. Can specify the mounts in /etc/fstab, linux format.
Troubleshooting boot up
Info from Jim. Appicable to old Mac (PowerPC)
If the critter won't start up with the C key held down, try the
following (with the CD in the drive)
Hold the Option key on startup, and choose the CD icon and then click
the right-pointing arrow, or
hold control-option-shift-delete on startup.
The former is an Open Firmware method, and the latter is a shortcut to
tell the MacOS Rom to boot form the next available system volume.
If both of these methods fail, restart and hold down option-apple-p-r
for four startup chimes, then try the above methods again. (this resets
iTerm : a better terminal prog than the one that comes with OS X.
sample startup script in location which is now deemed archaic:
/System/Library/StartupItems - Apple's only
/Library/StartupItems - User's customization
http://developer.apple.com/macosx/launchd.html launchd article from ADC
http://oreilly.com/pub/a/mac/2002/10/22/macforunix.html Mac tips for Unix geeks
screen /dev/tty.usbserial 9600
# ^A k : kill the connection (terminate screen and its use of /dev/tty...)
# ^A ^B b : send break (for sun's go prompt)
minicom -o -D /dev/tty.usbserial
minicom -o -D /dev/tty.usbserial -8 -b 9600
# ESC-z (hold esc while pressing z) is the default META-Z for help!)
# ESC-X (ESC + upper X at same time) = exit
# -o = don't init modem, since can't access /dev/modem
# no need to run as sudo
# brew install minicom
See also linux#minicom
Trying to install Mint 18.2 on a MacBook 12" mid-2017 (A1534) failed :(
So much about getting rid of macos :-(
- Does not recognize hard drive (MVMe flash drive)
- Perhaps can run it off usb...
- UEFI boot from USB Thumbdrive
- Need usb mouse and often keyboard.
- fonts are tiny cuz of the native resolution is very high, on a pretty small screen. graphics works (at the installer screen)
- mac cdrom drive don't really work. At boot loader, it doesn't seems to have driver for the cdrom drive. The drive will not inject/ingest a cdrom. So, it never became a boot option.
- Trying a Lenovo CDRom drive may give a slightly better mileage, at least it recognized the media...
- WiFi. works. even from Ubuntu 14.04 Life boot!!
- Dunedan has posted many relevant info.
- This may work, since it is actually supported by apple.
- They require Windows 10 ISO image, use the bootcamp assistant to get drivers.
- Probably can't get it to work with Windows 7, cuz bootcamp assistant on Mac High Sierra will not accept a windows 7 iso, insist on windows 10.
- Windows is closed source. Apple keep everything as secret. Don't expect them to leak out to the open source (albeit their servers certainly are running linux!!). Oh well, no one said this world was perfect right? hahaha
Why I hate Mac OS X ?
Update from High Sierra (2017.11)
- Linux terminal, highlight with mouse, paste with middle click. Or Shift-Insert. No middle click on any apple mouse/touchpad; or if there were, I have not been able to produce the paste behavior. The Terminal app allows pasting with PC mouse middle click. But the clipboard isn't shared with other app (eg chrome). So it is still often stilll needing the cmd-c and cmd-v. your hands has just to move between keyboard and mouse so much more often.
- How do you access the File menu with the keyboard? In Google Docs, Ctrl-Alt-f. Yeah yeah, on the mac it is called the option key. I like the derailure and change track logo. But that reminds me of Alternate path, not option. So there.
- Windows borders please. I have *a lot* of terminals windows open.
- Finder. It ain't file explorer/manager.
- Finder. Why can't you refresh? No way to trigger a refresh either??!!??!!
- Finder. Why is Cmd-N open a new tab? T for tab, no? Tab and window are two things, they each lead their own life.
- Finder: Where is the root of my file system? Go to Folder. Sh-Cmd-G, /.
- Finder: How do I select a lot, most, but not all files of a directory? Shift PageDown don't work? Oh that's right, steve jobs doesn't know what a Page Down key is. That's just any key, right?
- Finder: where are the pics on the iphone?? Run Image Capture.
- Image Capture: How do I move pics from the phone to the computer? Copy and delete.
- Finder: how many GB are these files taking up ?
- If I am on the mouse (not touchpad), how do i switch workspace? I got to click on where and where and where and where?? *sigh*
- Where is the Insert key? Cuz when I run a Linux VM (to get away from MacOS), I could really use that Insert key. A true Delete key would be quite useful too damn it!
* There is finally a lock screen option under the apple menu (^Cmd-Q). (I don't suppose this was added cuz linked an apple watch).
* There is finally a sleep option. while "closing the lid" is not explicity listed in the power setting, just don't let the computer go to sleep when the screen blanks. push out the screen saver.
These are cultural, but they have been imprinted into my brain.
- Sloppy mouse. Cuz I am a sloppy guy.
- I want Alt-Tab. Not Cmd-Tab AND Cmd-` AND Cmd-Lf/Rg. When I alt-tab between a browser and a terminal, i want ONE window to come to foreground, NOT ALL windows of the app to cover the other window I want to read things from!