Difference between revisions of "OS X for Linux people"

From DiLab
Jump to: navigation, search
(System and tools)
 
(47 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{TocRight}}
So you just run into OS X Lion or some other animal. I just did, too.
So you just run into a Lion or some other animal from OS X. I just did, too.
If feels like roaming through jungle while looking for gems. And finding them.
If feels like roaming through jungle while looking for gems. And finding them.


Some might call this
Some might call this


"'''10 or so things to do with MAC OS X/Macbook Air/Pro/Mini after you got it'''".
"'''10+ things to do with MAC OS X/Macbook Air/Pro/Mini after you got it'''".
{{TocRight}}


Let me share some simple things that took time.
Let me share some simple things that took time.
This is mostly about OS X 10.7+ Lion, which is the current version at the time.
This is mostly about OS X 10.7+ Lion and Mountain Lion, which is the current version at the time.

Update: I just got a new Macbook Air. Given the experiences from before, let me share my
'''[[Macbook Air install log]]''' (2013 version)




=Impressions and differences=
=Impressions and differences=
==...the good==
==...the good==
* Safe-mag power connector is the best. just sticks to the place, from front and behind, shows the status with a LED, and pulls off without effort.
* I like how the keyboard responds.
* I like how the keyboard responds. Soft and quiet.
* Backlight for the keys is nice, and should probably be used in most devices of the class.
* Multi-touch is nice and easy to get used to.
* The backlight under the keys is nice, and should probably be used in most such input devices.
* Multi-touch is nice and easy to get used to. Especially the scrolling, and moving windows (enable the 3-finger move in system prefs)
* Most installations for new software is easy. Download. Click on *.dmg. Maybe drag the new software icon to Applications. Enjoy (or hate) the new spoils.
* Most installations for new software is easy. Download and click on *.dmg file. Maybe drag the new software icon to Applications. Enjoy (or hate) the new spoils.


==...the bad, and sometimes ugly==
==...the bad, and sometimes ugly==
* Now backspace key is called delete and does backspace (like in the old days). But where is the delete key...?
* Now, the backspace key is called delete and does backspace (like in the old days). But where is the delete key...? Oh, well, it turns out you can press Fn+delete for the delete functionality.


* I am too used to linux/win control and alt key functionality. This throws me off. For example, I just accidentally switched panes again when wanted to jump a word back (pressed Ctrl+Left instead of Option/alt+Left).
* I am too used to linux/win control and alt key functionality. This throws me off. For example, I just accidentally switched panes again when wanted to jump a word back (pressed Ctrl+Left instead of Option/alt+Left).


* Integrated AppStore is ok, but rather limited, understandably so, to approved software. Oh,well, one can find many precompiled alternative software choices that serve ready to install .dmg files.
* Integrated AppStore is ok, but rather limited, understandably so, to approved software. Oh, well, one can find many alternative software choices on the Internet, as already precompiled .dmg files.

* The Finder file manager. I miss being in control of my files, and split/tab views, and folders being on top, and other things Nautilus and many Linux/Windows browsers have. Thankfully, there are some remedies, like the [http://totalfinder.binaryage.com/ TotalFinder] (not free) or MacPorts with Nautilus.


=Simple things=
=Simple things=
== Right click?==
== Right click?==
Easy. Click two fingers.
Easy. Tap (or click) two fingers.


== Tired of pressing that click on the Macbook? ==
== Tired of pressing that click on the Macbook? ==
Switch to "tap to click".
Switch to "tap to click".
System Preferences -> Trackpad -> Point & Click -> check Tap with one finger. It is quieter, too.
System Preferences -> Trackpad -> Point & Click -> check Tap with one finger. It is quieter, too.

I also enabled the three-finger move. Makes them window movement and text selection easier.

==Keyboard shortcuts==
===Delete key confusion===

The usual backspace key is named delete on Macbook, but it does backspace, which is fine.
But where is the Delete key that does forward-delete? No such key.

But you can use Fn+delete to do forward delete.
I guess the old typewriter keys dod not have a notion of deleting what has not been typed yet,
and therefore did not include such key on the keyboard. Sometimes Apple is conservative...

===A few other useful shortcuts===
* Fn+up/down is page up/down
* Fn+left/right is home/end
* Alt+delete will delete a whole word. Command+delete will delete the whole line to the left
* Fn+alt+delete will delete the next word forward.

===Keyboard remapping===

Control+arrow switches desktop panes. But I want it to jump words. This is where a keyboard remapping software, such as
[http://www.macupdate.com/app/mac/25141/keyremap4macbook '''KeyRemap4MacBook'''] comes in. Download and install it, then choose what keys or combinations change to what. My favorite remappings, coming from the PC world:

* '''Control+Arrow''' to '''Option_L+Arrow''', to get the control to skip words, not desks.
* '''Command_R''' to '''Option_R''', or else I keep pressing command+a to get 'ā' for my Latvian text, but it selects everything instead, and kills the text with the next stroke.
* '''Option_R''' to '''Forward-Delete''', to get my Del key back and close.
* '''Z'''+'''X''' to '''Left click''' (to make drag and drop easier with the touch pad)

==File manager==
The stock file manager is called Finder. There is a reason there are [http://bit.ly/X9ZLnH websites to tell you how to make it suck less] by enabling the path bar, adding tabs, panes, folders on top, and other good, basic things, or to replace it altogether ([http://bit.ly/X9ZYHn PathFinder]).

If you feel the pain, I suggest to try [http://bit.ly/Xa02XS TotalFinder] first, which adds some features to the default finder, including tabs and an option to sort files with the folders on top. It is free for 30 days, or $18 to buy at this time.


==Terminal==
==Terminal==
===Where to find===
You could search most things by clicking on the search icon at top right corner. Then type "Terminal" and see the options below.
You could search most things by clicking on the search icon at top right corner. Then type "Terminal" and see the options below.


Or you can go and explore the Launcher. Slide two fingers right to get the left pane, and you see the system (preinstalled) apps. The right pane show the downloaded or purchased apps that are installed. Go to the left pane Utilities -> Terminal to get the terminal.
Or you can go and explore the Launcher. Slide two fingers right to get the left pane, and you see the system (preinstalled) apps. The right pane show the downloaded or purchased apps that are installed. Go to the left pane Utilities -> Terminal to get the terminal.

I still want to create a systemwide shortcut for new terminal... '''TODO'''

===Terminal auto-close on shell exit===

OK, I press Ctrl+D to exit the terminal and it nicely tells me:

...$ logout
[Process Completed]

Thats not enough. I want the window to close when I am done. And this is what we need to do:
* Start the terminal
* Go menu -> Terminal -> Preferences -> Settings -> Shell -> "When the shell exits:" set to "Close if the shell exited cleanly"
* Close the Settings window
Now the Terminal window will close on Ctrl+D. It will also close when other programs invoke the shell and exit with no errors. If they have errors, the terminal will stay open so you can read about what went wrong.

===How to open apps from terminal===

For example, I would like to start TextWrangler editor from the command line.
If you just type the app name, this wont work.
Instead, type "open -a" and the app name.
Or better yet, create a short alias for that app, and put it in your startup script (.bash_profile or .bashrc)
For example, lets create a command line shortcut "tw" that will open the TextWrangler:

alias tw='open -a textwrangler ''


==There is no place like home==
==There is no place like home==
Line 43: Line 108:
For example, JOHN will have his home at /Users/JOHN, instead of /home/JOHN.
For example, JOHN will have his home at /Users/JOHN, instead of /home/JOHN.
Be prepared to love $HOME in your shell scripts instead of the explicit pathnames with "home" in them.
Be prepared to love $HOME in your shell scripts instead of the explicit pathnames with "home" in them.



==Where's my apt-get install?==
==Where's my apt-get install?==


Not there. But there are:
Not there. But there is MacPorts, that you may want to install to ease the path to other open source software. Goto http://macports.org and install their package by following their instructions.

* [http://macports.org MacPorts] that you may want to install to ease the path to other open source software. Mind, that many of the packages will compile from source and drag all the requirements with them. This will take time and space.

* [http://brew.sh/ Homebrew]. Mostly easier than macports, but fewer packages, although the macports cound several versions of applications as separate packages. Homebrew is striving to depend on native OSX resources when available.

* There is also Fink, that I won't talk about much here.


==Where is my .bashrc ?==
==Where is my .bashrc ?==


You want it - create it.
You want it - create it.
You might also want to create and add the following in your .bash_profile
You might also want to create and add the following in your .bash_profile, because .bashrc will not start automatically.
if [ -f ~/.bashrc ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
. ~/.bashrc
fi
fi



==Wine, please==
==Wine, please==
for my windows stuff, such as old Visual Basic programs. This will be easier with MacPorts.
for my windows stuff, such as old Visual Basic programs.

Alternative ways to do windows on Mac are:
* [http://winebottler.kronenberg.org/ Winebottler]
* [[#Wine with MacPorts | Wine with MacPorts]], which you may find useful in other ways too
* Virtual OS using VirtualBox (free) or Parallels (well integrated)
* dual boot ([http://support.apple.com/kb/HT1461 Bootcamp])

May I recommend [http://winebottler.kronenberg.org/ Winebottler]? This will take care of your wine in a quick and rather painless way.

Mind you, winebottler was not friendly with Parallels on my Mac.


===Wine with MacPorts===


Here is one how-to: http://www.davidbaumgold.com/tutorials/wine-mac/
Here is one how-to: http://www.davidbaumgold.com/tutorials/wine-mac/

What this tells you to do is:
* Set up Xcode from apple (free from AppStore)
* Install "Command line tools" from Xcode - registration required as an apple developer
* Download and set up MacPorts, so you could run "port install wine".
* Install wine using MacPorts from the terminal. Then have a rather long coffee or tee or just nap while everything downloads and compiles.

sudo port install wine

* I'd add that you will probably need and like to add winetricks. This will ease the installation of various dlls and components needed for your windows programs, such as mfc42.dll.

sudo port install winetricks


==Starting apps form the command line==
==Starting apps form the command line==
Line 70: Line 166:
Haha! Now I can create alias(es) for my favorite apps to be invoked from CLI. You could, too.
Haha! Now I can create alias(es) for my favorite apps to be invoked from CLI. You could, too.
Here is [http://osxdaily.com/2007/02/01/how-to-launch-gui-applications-from-the-terminal/ more info]
Here is [http://osxdaily.com/2007/02/01/how-to-launch-gui-applications-from-the-terminal/ more info]

==Add recent servers, documents,... to the Dock==

I have a linksys e4200 wireless router with a USB drive attached to it. Unfortunately, my Mac forgets about the shared drive. I wanted to add a shortcut to it somewhere, and finally found a way: Add a stack with "Recent Items" to the dock. This is the magic:

* Start the Terminal, and enter the following:

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'

* The Dock will disappear and appear again after this:

killall Dock

* Close the terminal. You should have a "Recent (something)" icon on the right of your Dock. You can change the properties with two-click (right-click) on it to show the recent Servers or what fits you.

More info here: [http://macs.about.com/od/usingyourmac/qt/dockrecentitem.htm here].


== Encript folders with EncFS ==

EncFS is a cross platform virtual file system that mounts a volume over one directory and encrypts everything written to it to another physical directory.

EncFS is installed as follows:

* Install [http://osxfuse.github.io/ OSXfuse]
* Install EncFS using homebrew:
brew install encfs

* Use Encfs to mount an encrypted volume
encfs ~/Dropbox/Private.enc/ ~/Private/
# or with a custom volume name
encfs ~/Dropbox/Private.enc/ ~/Private/ -- -o volname="Dropbox private"


=Useful applications=
=Useful applications=


There is a list of some applications or packages that I set up on my Mac.
There is a list of some applications or packages that I set up on my Mac.

== ...from the AppStore==
== ...from the AppStore==
* The Unarchiver - to get them archives unfold
* TextWrangler - text or source code editor
* MPlayerX - video player inspired by the classic mplayer
* Smart Converter - between video formats
* Keynote - for presentations. Beats Powerpoint at $20.
* Keynote - for presentations. Beats Powerpoint at $20.
* Xcode - useful and free from apple for development or installing some other packages.
* Xcode - useful and free from apple for development or installing some other packages.
* Karabiner-Elements - redefine the keyboard keys and add shortcut combinations
* The Unarchiver - to get them archives unfold


== ...from the Internet==
== ...from the Internet==
===System and tools===
* [http://www.macupdate.com/app/mac/25141/keyremap4macbook KeyRemap4MacBook] - Keyboard remapper, for the modifier keys and arrows.
* [http://www.macports.org/ MacPorts] - enables other good open source software
* [http://www.macports.org/ MacPorts] - enables other good open source software
* [[brew on MacOS] - alternative to macports. A better one?
* [http://totalfinder.binaryage.com/ TotalFinder] - makes the Finder suck less. Might be obsolete by now.
* [http://code.haleby.se/2017/01/27/markdown-to-pdf-in-macosx/ Installing Pandoc] - convert markdown documets to pdf and other formats.

====Less often used====
* [http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele Ukelele] - a keyboard layout editor. But it cannot change the modifier keys, such as control, option, command.
* [http://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-mac-home-edition.aspx Sophos antivirus] - free, MAC home edition

===Applications===
* [http://www.videolan.org/vlc/ VLC] - plays almost any type of video
* [http://www.gnu.org/software/pspp/ PSPP] - a statistical software like SPSS, but under GNU licence.
* [http://www.gnu.org/software/pspp/ PSPP] - a statistical software like SPSS, but under GNU licence.

=Recovery=

Things happen. it may be that your mac acts up and you need to troubleshoot the boot process and recover your data.

==Backup with cp==
One way to backup your data is to plug in a USB drive and boot into recovery mode with pressing CMD+R while booting.
From there you can use the Disk utility to check the integrity of the disk. After that you can close the disk utility and open a Terminal and use unix commands to troubleshoot and also to backup your data.

Note, another way to enter a terminal would be booting it a single user mode (Ctrl+S down while booting), but mounting a USB drive or recognizing it might proove to be a challenge. In the Recovery moe it was mounted automatically, and you can also verify its integrity before the backup, if you wish.

There are ways to do backups Macos way, however the story below is how to do it Unix way using cp command. Another way would be to use rsync, but that was not available for me in the recovery mode.

Tasks:
* You may want to make your file system read and writeable. Optionally check it for defects before:
/sbin/fsck -fy
/sbin/mount -uw /
Mount the USB drive (unless automounted)
* Find the USB disk device. The usb disk is likely to be the last one, e.g. disk21s1
ls /dev/disk*
* Make a directory for the mount point:
mkdir /Volumes/usbdisk
* Determine the type of the filesystem on the USB disk (NTFS or FAT or HFS or ...)
fstyp /dev/disk2s1
* it is likely that the USB disk is already mounted (find it under the /Volumes/...) in read only mode. You may mount it in read write, but before that unmount the old location:
umount /Volumes/MyUsbDrive

* Mount the disk as a read-write, so you can access its filesystem with the regular commands
*** For the NTFS file system:
mount -t ntfs -o rw,auto,nobrowse /dev/disk2s1 /Volumes/usbdisk
*** For the FAT file system
mount -t msdos /dev/disk2s1 /Volumes/usbdisk
*** For the HFS (mac) file system
mount -t hfs /dev/disk2s1 /Volumes/usbdisk

* Copy the files, preserve attributes ("-p"). "-X" is for not copying the access lists and resource forks to avoid copy errors to NTFS.
cp -npRXv "/Volumes/MyMainMacDisk/Users/myuser" "/Volumes/usbdisk/mybackup/myuser"

* Alternatively, some people prefer ''rsync'' to ''cp''
rsync -av -P /path/to/source /path/to/destination

Note, that in the recovery mode the computer may enter sleep mode and stop the backup after a while. To prevent this you can use ''caffeinate'' command. Ctrl+C to exit the no-sleep mode, e.g. when done copying.
caffeinate
If you want to keep the display awake as well, use a stronger command version:
caffeinate -dismut 65500
This should keep the computer awake for some 18 hours.

* Finally, when the copying is done, you can unmount the USB disk before shutting down the computer:
umount /Volumes/usbdisk
or
umount /dev/disk21s1

== Resetting a new user account on macos==
From a single user mode (press Ctrl+S while booting)
mount -uw /
rm /var/db/.AppleSetupDone
shutdown -h
This will:
* Re-mount the internal hard drive with write permission
* Remove the Mac setup file. This is the file that OS X checks to determine if the system is already set up.
* Shutdown the Mac
Then restart and you should be prompted for a new user account.

Latest revision as of 08:09, 9 September 2020

So you just run into a Lion or some other animal from OS X. I just did, too. If feels like roaming through jungle while looking for gems. And finding them.

Some might call this

"10+ things to do with MAC OS X/Macbook Air/Pro/Mini after you got it".

Let me share some simple things that took time. This is mostly about OS X 10.7+ Lion and Mountain Lion, which is the current version at the time.

Update: I just got a new Macbook Air. Given the experiences from before, let me share my Macbook Air install log (2013 version)


Impressions and differences

...the good

  • Safe-mag power connector is the best. just sticks to the place, from front and behind, shows the status with a LED, and pulls off without effort.
  • I like how the keyboard responds. Soft and quiet.
  • The backlight under the keys is nice, and should probably be used in most such input devices.
  • Multi-touch is nice and easy to get used to. Especially the scrolling, and moving windows (enable the 3-finger move in system prefs)
  • Most installations for new software is easy. Download and click on *.dmg file. Maybe drag the new software icon to Applications. Enjoy (or hate) the new spoils.

...the bad, and sometimes ugly

  • Now, the backspace key is called delete and does backspace (like in the old days). But where is the delete key...? Oh, well, it turns out you can press Fn+delete for the delete functionality.
  • I am too used to linux/win control and alt key functionality. This throws me off. For example, I just accidentally switched panes again when wanted to jump a word back (pressed Ctrl+Left instead of Option/alt+Left).
  • Integrated AppStore is ok, but rather limited, understandably so, to approved software. Oh, well, one can find many alternative software choices on the Internet, as already precompiled .dmg files.
  • The Finder file manager. I miss being in control of my files, and split/tab views, and folders being on top, and other things Nautilus and many Linux/Windows browsers have. Thankfully, there are some remedies, like the TotalFinder (not free) or MacPorts with Nautilus.

Simple things

Right click?

Easy. Tap (or click) two fingers.

Tired of pressing that click on the Macbook?

Switch to "tap to click". System Preferences -> Trackpad -> Point & Click -> check Tap with one finger. It is quieter, too.

I also enabled the three-finger move. Makes them window movement and text selection easier.

Keyboard shortcuts

Delete key confusion

The usual backspace key is named delete on Macbook, but it does backspace, which is fine. But where is the Delete key that does forward-delete? No such key.

But you can use Fn+delete to do forward delete. I guess the old typewriter keys dod not have a notion of deleting what has not been typed yet, and therefore did not include such key on the keyboard. Sometimes Apple is conservative...

A few other useful shortcuts

  • Fn+up/down is page up/down
  • Fn+left/right is home/end
  • Alt+delete will delete a whole word. Command+delete will delete the whole line to the left
  • Fn+alt+delete will delete the next word forward.

Keyboard remapping

Control+arrow switches desktop panes. But I want it to jump words. This is where a keyboard remapping software, such as KeyRemap4MacBook comes in. Download and install it, then choose what keys or combinations change to what. My favorite remappings, coming from the PC world:

  • Control+Arrow to Option_L+Arrow, to get the control to skip words, not desks.
  • Command_R to Option_R, or else I keep pressing command+a to get 'ā' for my Latvian text, but it selects everything instead, and kills the text with the next stroke.
  • Option_R to Forward-Delete, to get my Del key back and close.
  • Z+X to Left click (to make drag and drop easier with the touch pad)

File manager

The stock file manager is called Finder. There is a reason there are websites to tell you how to make it suck less by enabling the path bar, adding tabs, panes, folders on top, and other good, basic things, or to replace it altogether (PathFinder).

If you feel the pain, I suggest to try TotalFinder first, which adds some features to the default finder, including tabs and an option to sort files with the folders on top. It is free for 30 days, or $18 to buy at this time.

Terminal

Where to find

You could search most things by clicking on the search icon at top right corner. Then type "Terminal" and see the options below.

Or you can go and explore the Launcher. Slide two fingers right to get the left pane, and you see the system (preinstalled) apps. The right pane show the downloaded or purchased apps that are installed. Go to the left pane Utilities -> Terminal to get the terminal.

I still want to create a systemwide shortcut for new terminal... TODO

Terminal auto-close on shell exit

OK, I press Ctrl+D to exit the terminal and it nicely tells me:

...$ logout
[Process Completed]

Thats not enough. I want the window to close when I am done. And this is what we need to do:

  • Start the terminal
  • Go menu -> Terminal -> Preferences -> Settings -> Shell -> "When the shell exits:" set to "Close if the shell exited cleanly"
  • Close the Settings window

Now the Terminal window will close on Ctrl+D. It will also close when other programs invoke the shell and exit with no errors. If they have errors, the terminal will stay open so you can read about what went wrong.

How to open apps from terminal

For example, I would like to start TextWrangler editor from the command line. If you just type the app name, this wont work. Instead, type "open -a" and the app name. Or better yet, create a short alias for that app, and put it in your startup script (.bash_profile or .bashrc) For example, lets create a command line shortcut "tw" that will open the TextWrangler:

alias tw='open -a textwrangler 

There is no place like home

Well, there is. It (the directory) is called Users, not home. For example, JOHN will have his home at /Users/JOHN, instead of /home/JOHN. Be prepared to love $HOME in your shell scripts instead of the explicit pathnames with "home" in them.


Where's my apt-get install?

Not there. But there are:

  • MacPorts that you may want to install to ease the path to other open source software. Mind, that many of the packages will compile from source and drag all the requirements with them. This will take time and space.
  • Homebrew. Mostly easier than macports, but fewer packages, although the macports cound several versions of applications as separate packages. Homebrew is striving to depend on native OSX resources when available.
  • There is also Fink, that I won't talk about much here.

Where is my .bashrc ?

You want it - create it. You might also want to create and add the following in your .bash_profile, because .bashrc will not start automatically.

if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

Wine, please

for my windows stuff, such as old Visual Basic programs.

Alternative ways to do windows on Mac are:

May I recommend Winebottler? This will take care of your wine in a quick and rather painless way.

Mind you, winebottler was not friendly with Parallels on my Mac.


Wine with MacPorts

Here is one how-to: http://www.davidbaumgold.com/tutorials/wine-mac/

What this tells you to do is:

  • Set up Xcode from apple (free from AppStore)
  • Install "Command line tools" from Xcode - registration required as an apple developer
  • Download and set up MacPorts, so you could run "port install wine".
  • Install wine using MacPorts from the terminal. Then have a rather long coffee or tee or just nap while everything downloads and compiles.
sudo port install wine
  • I'd add that you will probably need and like to add winetricks. This will ease the installation of various dlls and components needed for your windows programs, such as mfc42.dll.
sudo port install winetricks

Starting apps form the command line

OK, I got the terminal. I even got nano. But I want, say, TextWrangler to edit my text file. How?

Use "open". For example, if you want to edit your .bashrc then do this:

open -a TextWrangler .bashrc

Haha! Now I can create alias(es) for my favorite apps to be invoked from CLI. You could, too. Here is more info

Add recent servers, documents,... to the Dock

I have a linksys e4200 wireless router with a USB drive attached to it. Unfortunately, my Mac forgets about the shared drive. I wanted to add a shortcut to it somewhere, and finally found a way: Add a stack with "Recent Items" to the dock. This is the magic:

  • Start the Terminal, and enter the following:
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
  • The Dock will disappear and appear again after this:
killall Dock
  • Close the terminal. You should have a "Recent (something)" icon on the right of your Dock. You can change the properties with two-click (right-click) on it to show the recent Servers or what fits you.

More info here: here.


Encript folders with EncFS

EncFS is a cross platform virtual file system that mounts a volume over one directory and encrypts everything written to it to another physical directory.

EncFS is installed as follows:

  • Install OSXfuse
  • Install EncFS using homebrew:
brew install encfs
  • Use Encfs to mount an encrypted volume
encfs ~/Dropbox/Private.enc/ ~/Private/
# or with a custom volume name
encfs ~/Dropbox/Private.enc/ ~/Private/ -- -o volname="Dropbox private"

Useful applications

There is a list of some applications or packages that I set up on my Mac.

...from the AppStore

  • The Unarchiver - to get them archives unfold
  • TextWrangler - text or source code editor
  • MPlayerX - video player inspired by the classic mplayer
  • Smart Converter - between video formats
  • Keynote - for presentations. Beats Powerpoint at $20.
  • Xcode - useful and free from apple for development or installing some other packages.
  • Karabiner-Elements - redefine the keyboard keys and add shortcut combinations

...from the Internet

System and tools

  • KeyRemap4MacBook - Keyboard remapper, for the modifier keys and arrows.
  • MacPorts - enables other good open source software
  • [[brew on MacOS] - alternative to macports. A better one?
  • TotalFinder - makes the Finder suck less. Might be obsolete by now.
  • Installing Pandoc - convert markdown documets to pdf and other formats.

Less often used

  • Ukelele - a keyboard layout editor. But it cannot change the modifier keys, such as control, option, command.
  • Sophos antivirus - free, MAC home edition

Applications

  • VLC - plays almost any type of video
  • PSPP - a statistical software like SPSS, but under GNU licence.

Recovery

Things happen. it may be that your mac acts up and you need to troubleshoot the boot process and recover your data.

Backup with cp

One way to backup your data is to plug in a USB drive and boot into recovery mode with pressing CMD+R while booting. From there you can use the Disk utility to check the integrity of the disk. After that you can close the disk utility and open a Terminal and use unix commands to troubleshoot and also to backup your data.

Note, another way to enter a terminal would be booting it a single user mode (Ctrl+S down while booting), but mounting a USB drive or recognizing it might proove to be a challenge. In the Recovery moe it was mounted automatically, and you can also verify its integrity before the backup, if you wish.

There are ways to do backups Macos way, however the story below is how to do it Unix way using cp command. Another way would be to use rsync, but that was not available for me in the recovery mode.

Tasks:

  • You may want to make your file system read and writeable. Optionally check it for defects before:
/sbin/fsck -fy 
/sbin/mount -uw / 

Mount the USB drive (unless automounted)

  • Find the USB disk device. The usb disk is likely to be the last one, e.g. disk21s1
ls /dev/disk*
  • Make a directory for the mount point:
mkdir /Volumes/usbdisk
  • Determine the type of the filesystem on the USB disk (NTFS or FAT or HFS or ...)
fstyp /dev/disk2s1
  • it is likely that the USB disk is already mounted (find it under the /Volumes/...) in read only mode. You may mount it in read write, but before that unmount the old location:
umount /Volumes/MyUsbDrive
  • Mount the disk as a read-write, so you can access its filesystem with the regular commands
      • For the NTFS file system:
mount -t ntfs -o rw,auto,nobrowse /dev/disk2s1 /Volumes/usbdisk
      • For the FAT file system
mount -t msdos /dev/disk2s1 /Volumes/usbdisk
      • For the HFS (mac) file system
mount -t hfs /dev/disk2s1 /Volumes/usbdisk
  • Copy the files, preserve attributes ("-p"). "-X" is for not copying the access lists and resource forks to avoid copy errors to NTFS.
cp -npRXv "/Volumes/MyMainMacDisk/Users/myuser" "/Volumes/usbdisk/mybackup/myuser"
  • Alternatively, some people prefer rsync to cp
rsync -av -P /path/to/source /path/to/destination

Note, that in the recovery mode the computer may enter sleep mode and stop the backup after a while. To prevent this you can use caffeinate command. Ctrl+C to exit the no-sleep mode, e.g. when done copying.

caffeinate

If you want to keep the display awake as well, use a stronger command version:

caffeinate -dismut 65500

This should keep the computer awake for some 18 hours.

  • Finally, when the copying is done, you can unmount the USB disk before shutting down the computer:
umount /Volumes/usbdisk

or

umount /dev/disk21s1

Resetting a new user account on macos

From a single user mode (press Ctrl+S while booting)

mount -uw /
rm /var/db/.AppleSetupDone
shutdown -h

This will:

  • Re-mount the internal hard drive with write permission
  • Remove the Mac setup file. This is the file that OS X checks to determine if the system is already set up.
  • Shutdown the Mac

Then restart and you should be prompted for a new user account.