Archivi tag: Mac OS X

Macintosh startup key sequences

This is a collection of the (poorly documented) key-sequences that do things. It’s probably possible to find all this information within Apple’s Knowledge Base, but it’s currently scattered across multiple entries. In any case, this came from a number of smart people, but Marc Pawliger started the list and Tim Hume collected the various responses. Miro, Andy, Darin, Chris, Barry, the other Marc, Greg, Jon and Ned offered clarifications. I just turned it into a web-page.

It’s pretty sad that there are so many “hidden” things in an OS that’s supposed to be so easy to use. I hadn’t thought about it before, but the sheer volume of them has surprised me. I knew of the existence of a lot of these shortcuts myself, but I’d never tried to think of them all at once until I started compiling this page. Now that I have many of them in one place (there’s more to be added – I think there always will be), I find myself wondering about ease of use. Anyway, enjoy.

On boot

Key CombinationEffect
mouse downEject removable media ( I think Boot ROMs prior to 2.4f1 excluded the CD drive )
optBring up OF system picker on New World machines – boot to 9 on pre-New World machines
F8Bring up Mac OS X boot partition selector (DTKs only?)
cmd-periodWhen OF system picker is active, open the CD tray
cmd-optHold down until 2nd chime, will boot into Mac OS 9 ?
cmd-x (or just x?)Will boot into Mac OS X if 9 and X are on the same partition and that’s the partition you’re booting from.
cmd-opt-n-dprevent native drivers from loading (System 7 until 9.x?)
cmd-opt-shift-deleteBypass startup drive and boot from external (or CD). This actually forces the system to NOT load the driver for the default volume, which has the side effect mentioned above. For SCSI devices it searches from highest ID to lowest for a partition with a bootable system. Not sure about IDE drives.
cmd-opt-shift-delete-#Boot from a specific SCSI ID # (# = SCSI ID number)
cmd-opt-p-rZap PRAM. Hold down until second chime.
cmd-opt-n-vClear NV RAM. Similar to reset-all in Open Firmware.
cmd-opt-o-fBoot into open firmware
cmd-opt-t-vForce Quadra AV machines to use TV as a monitor
cmd-opt-x-oBoot from ROM (Mac Classic only)
cmd-opt-a-vForce an AV monitor to be recognized as one
cBoot from CD. If set to boot to X and no CD is present, may boot to 9.
dForce the internal hard disk to be the startup device
nHold down until Mac logo, will attempt to boot from network server (using BOOTP or TFTP)
rForce PowerBooks to reset the screen
tPut FireWire machine into FireWire Target Disk mode
zAttempt to boot using the devalias zip from first bootable partition found
ctl-cmd-shift-powerReset power manager (with computer off)
shift(Classic only) Disable Extensions
shift(OS X, 10.1.3 and later) Disables login items. Also disables non-essential kernel extensions (safe boot mode)
cmd(Classic only) Boot with Virtual Memory off
cmd-v(OS X only) show console messages (verbose mose) during boot. Also invokes Safe Mode
cmd-s(OS X only) boot into single user mode
cmd-opt-c-i(Mac IIci only) Set date to 20 Sep 1989 to get a graphical easter egg
cmd-opt-f-x(Mac IIfx only) Set date to 19 Mar 1990 to get a graphical easter egg
cmd-opt-shift-tab-deleteErase startup disk under 7.1(?)

After display of Happy Mac icon

Key CombinationEffect
space(Classic only) Invoke Extensions Manager
shift(Classic only) Disable Extensions including MacsBug
shift-opt(Classic only) Disable exetensions, except MacsBug
ctrl(Classic only) Break into MacsBug as soon as it is loaded

At login window

Key CombinationEffect
shift(10.x only) Disable auto-login, forcing login window

As Finder Starts

Key CombinationEffect
cmd-opt(whenever Classic Finder sees a new disk) Rebuild Desktop
opt(Mac OS 9) Do not open Finder windows
shift(Mac OS X) Do not launch startup items. Do not open Finder windows when launching Finder. The windows’ states aren’t changed to closed, as they will be reopened if you reboot again.
shift(Mac OS 9) Do not launch anything from the “Startup Items” folder.

In Finder

Key CombinationEffect
opt-click close box (or cmd-opt-w)Close all open finder windows (except popup windows)
cmd-shift-opt-wClose all open finder windows (including popup windows)
cmd-right arrowOpen folder in list view
cmd-opt-right arrowRecursively open folder and nested folders in list view
cmd-left arrowClose folder in list view
cmd-opt-left arrowRecursively close folder and nested folders in list view
cmd-up arrowOpen parent folder. On Mac OS X, when nothing is selected and no windows are open, open User directory
cmd-opt-up arrowOpen parent folder, closing current folder
cmd-opt-shift-up arrowMake desktop the active window, select parent volume
cmd-down arrowOpen selected item. On Mac OS X, when nothing is selected and no windows are open, open the desktop folder
cmd-opt-down arrowOpen selected item, closing current folder
cmd-opt-oOpen selected item, closing current folder
opt-double-clickOpen selected item, closing current folder
opt-click(In disclosure triangle) expand or collapse all folders within that window
tabselect next icon alphabetically
shift-tabselect previous item alphabetically
cmd-deletemove selection to trash
cmd-shift-deleteempty trash
spacewhile navigating, opens folder under mouse immediately (with spring-loaded folders enabled)
In Finder Window Menu
cmd-selectClose window
cmd-shift-selectPut away popup window
cmd-opt-selectExpand selected window and close all others
ctl-selectExpand selected window and collapse all others
ctl-opt-selectActivate selected window and expand all others

On disk mount

Key CombinationEffect
md-opt(whenever Classic Finder sees a new disk) Rebuild Desktop
opt(Mac OS 9) Add session numbers (;1, ;2, etc) to ISO-9660 CD filenames
opt(Mac OS X) Show each session on an ISO-9660 CD as a volume
cmd-opt-iForce-mount ISO-9660 partition of a CD, rather than a Mac partition

After startup

Key CombinationEffect
On machines with a power key
powerBring up dialog for shutdown, sleep or restart (see next table)
cmd-ctrl-powerUnconditionally reboot (sometimes referred to as “control flower power” to easily remember) (dirty reboot – may corrupt disk)
ctrl-cmd-opt-powerFast shutdown
cmd-powerBring up debugger (if debugger installed). Really old macs (mac ii era) needed Paul Mercer’s debugger init to do this, then it got folded into the firmware, around 040 timeframe.
cmd-opt-powerPut late model PowerBooks & Desktops to sleep
cmd-opt-ctrl-power(PowerBook 500) Reset Power Manager
shift-fn-ctrl-power(PowerBook G3, G4) Reset Power Manager
On machines without a power key
ctrl-ejectBring up dialog for shutdown, sleep or restart (see next table)
cmd-ctrl-ejectUnconditionally reboot
ctrl-cmd-opt-ejectFast shutdown
cmd-ejectBring up debugger (if debugger installed). Really old macs (mac ii era) needed Paul Mercer’s debugger init to do this, then it got folded into the firmware, around 040 timeframe.
cmd-opt-ejectPut late model PowerBooks & Desktops to sleep
On all machines
cmd-opt-escForce quit current app
cmd-shift-0Put late model PowerBooks & Desktops to sleep No longer work in OS X. On Macs with three floppy drives (Mac SE) they eject the third floppy disk.
cmd-shift-1 or 2Eject internal or external floppy. Not sure which is which on dual floppy machines (Mac SE, Mac II, etc.)
cmd-shift-3Screen shot
cmd-shift-4Abstract user defined area screen shot (hold control while selecting to direct it to the clipboard on Mac OS 9)
cmd-shift-capslock-4(Classic only) User selectable window screen shot
cmd-ctl-shift-3Screen shot to clipboard
cmd-ctl-shift-4Abstract user defined area screen shot to clipboard
cmd-ctl-shift-capslock-4(Classic only) User selectable window screen shot to clipboard (classic only)
cmd-tabSwitch apps (possible to change key in Mac OS 8-9)
cmd-shift-tabSwitch apps in reverse order
cmd-spaceSwitch keyboards/script systems (if more than one is installed)
cmd-opt-spaceswitch through all keyboards in keyboards menu
opt-f3, opt-f4 or opt-f5bring up the system preferences (Mac OS X only – maybe powerbooks only? only if system preferences isn’t already running)
cmd-f1toggle between video mirroring and extended desktop mode (works on Ti Powerbooks)
opt-f1open the displays preference (10.2 and later)
cmd-f2auto-detect a newly-connected display (works on Ti Powerbooks)
opt-f2open the displays preference (10.2 and later)
opt-f3, f4, or f5open the Sounds preference (10.2 and later)
opt-f8, f9, or f10open the Keyboard and Mouse preference (10.2 and later)
f12Eject CD/DVD (must be held down on 10.1.2 or later). If the device can be dismounted, it is. If not, nothing happens.
f14dim display (cubes/g4 iMacs/others?)
f15brighten display (cubes/g4 iMacs/others?)
cmd-ctl-shift-0Spin down HD (when possible) on machines running OS 9
cmd-`cycle through current application’s windows (Mac OS X 10.2 only?)
cmd-~cycle through current application’s windows (reverse order) (Mac OS X 10.2 only?)
opt-“Empty Trash”Emptry trash without locked file or contents summary alert. Empties locked items, as well
cmd-opt-D(Mac OS X only) toggle dock
cmd-opt (when opening chooser)(Mac OS 9 only) rebuild chooser cache of printer driver information
cmd-opt-ctl-8(Mac OS X, 10.2 or later) Turn on “Inverse Mode” via accessbility.
cmd-opt-8(Mac OS X, 10.2 or later) Turn on “Zoom Mode” via accessbility.
cmd-opt-plus(Mac OS X, 10.2 or later) Zoom In via accessbility.
cmd-opt-minus(Mac OS X, 10.2 or later) Zoom Out via accessbility.

In the sleep/restart dialog

Key CombinationEffect
SSleep
RRestart
esccancel
cmd-. (period)cancel
Return or EnterShut Down
PowerCancel (9.2.x only?)

In other dialogs

Key CombinationEffect
escCancel
command-. (period)Cancel
enterDefault button
returnDefault button (if there are no text fields that use return
cmd-dDon’t save (in save/cancel/don’t save dialog)
cmd-rReplace (in “Do you want to replace this file” dialog, Mac OS X only)

On keyboards with a function key

Key CombinationEffect
fn-backspaceforward delete
fn-left arrowhome
fn-right arrowend
fn-up arrowpage up
fn-down arrowpage down

Clicks

Click /ModifierEffect
option-click in another applicationSwitch to that application and hide previous app
cmd-drag (window)Drag window without bringing it to front (requires application support to work behind dialogs)
cmd-drag (window background)Pan contents of window with hand (Finder)
cmd-opt-drag (window background)Option may be needed to pan contents of window with hand (Finder) on 10.3 and later
cmd-drag (Mac OS X)Rearrange menu extras
opt-drag (file)Copy file
cmd-opt-drag (file)Make alias of file
cmd-click window titlePop-up menu showing path to current folder/document (in some applications)
option-windowshadeWindowshade all windows of application (classic only)
option-zoomZoom window to full-screen
option-yellowDock all windows of application (Mac OS X only)
option-greenZoom window to fill screen (in some applications)
Mac OS X only – items in dock
cmd-clickReveal in Finder
cmd-opt-clickActivate app and hide other apps
ctl-click (or click and hold)contextual menu
cmd-drag into dockFreeze current dock items from moving so icon can be dropped onto an app
cmd-opt-drag into dockForce application you’re dropping onto to open dropped item

Control Strip

ActionEffect
opt-drag control stripMove control strip
opt-drag CS module within stripreorders CS modules
opt-drag CS module to trashuninstalls a module
opt-drag CS module elsewherewhatever dragging the module file itself would

Terminale migliorato in Mac OS X

Un piccolo consiglio per migliorare il Terminale in Mac OS X. Prima di proseguire vi prego di notare che non ho scritto “macOS” di proposito in quanto questo trick è consigliato per chi usa bash come interprete dei comandi nelle versioni meno recenti del sistema operativo con la mela.

Innanzitutto assicuriamoci che esista il file ~/.bash_profile nella propria home e che contenga quanto segue:

if [ -r ~/.bashrc ]; then
source ~/.bashrc
fi

Quindi andiamo a personalizzare il prompt dei comandi editando il file ~/.bashrc e inserendo quanto segue:

export PS1="[\033[36m]\u[\033[m]@[\033[32m]\h:[\033[33;1m]\w[\033[m]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
alias ll='ls -lah'

Sulla rete si trovano molti esempi di personalizazzione. Queste sono le mie impostazioni preferite.

Convertire i filmati H.265/HEVC

La codifica H.265/HEVC porta con sé numerosi vantaggi, come il supporto a risoluzioni 8K, ma non viene ancora supportato a dovere dai Mac

Il successore della codifica H.264/MPEG-4 AVC (Advanced Video Coding), H.265/HEVC per l’appunto, offre la possibilità di comprimere i dati in modo efficace, senza perdere di qualità, o la possibilità di supportare risoluzioni 4K e 8K UHD fino a 8192 x 4320. Tuttavia, non viene ancora supportato a dovere e richiede inoltre molte risorse per la loro risoluzione. VLC, che spesso ci viene in aiuto, ancora non li riproduce in maniera fluida e senza artefatti.

Ecco allora la necessità di convertirli in un formato  più compatibile. Possiamo utilizzare FFmpeg a riga di comando:

$ ffmpeg -i inputfilename_h265.mp4 -c:a copy -c:v libx264 -preset slow -crf 18 outputfilename.mp4

sostituendo inputfilename_h265.mp4 con il nome del file H.265 nativo che si desidera convertire, e outputfilename.mp4 con il nome del file di destinazione che vogliamo creare in H.264.

Per chi non ce lo avesse già installato sul proprio Mac, è possibile farlo tramite MacPorts:

$ sudo port install ffmpeg +nofree

Il pacchetto si porta con sé molte dipendenze e a seconda dei casi l’installazione richiederà alcuni minuti.

Come cercare la posizione geografica di un indirizzo IP dalla riga di comando

Se si desidera cercare la posizione geografica di un indirizzo IP esistono diversi servizi online, come ad esempio Geo IP Tool. Tra questi è possibile provare il servizio ipinfo.io. A differenza di altri, ipinfo.io fornisce API di geolocalizzazione basate su JSON, quindi puoi facilmente cercare la geolocalizzazione dalla riga di comando, usando strumenti come curl.

Per esempio:

$ curl ipinfo.io/216.58.205.163

{
"ip": "216.58.205.163",
"hostname": "mil04s28-in-f3.1e100.net",
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.4192,-122.0570",
"postal": "94043",
"org": "AS15169 Google LLC"
}