From OS X to Arch Linux: Part #5: Prelude

Booting to other operating systems

TL;DR: just hold the Option (Alt) key while booting.

Yeah, you’ve read it right: the title is not wrong. I intend to install Arch Linux on a Mac, by optimizing these conditions:

  • the primary operating system of the Mac should be OS X
    • Implication #1: most of the disk space is gonna be allocated to OS X (in fact, I’ll reserve only 16 GB to my Arch system; my SSD has 256GB).
    • Implication #2: most storage will be done on OS X (movies, pictures, etc). In fact, most web browsing will be done on OS X too. Arch is gonna be useful to (for example) access connections that require more security (e.g. bank accounts), CTF stuff, hardcore low-level programming stuff (haha).
    • Implication #3: most desktop programs will be installed on OS X only. This includes, for example, audacity, VLC, etc. This Arch will be a lightweight system, with just low-disk usage apps. It will almost look like a Chrome OS, except that I’m not using it just for web browsing, but for several Linux stuff that I like. Hobby is a thing, ya see.
    • Implication #4: grub is not taking control of this machine. Neither systemd-bootd. I’ll stick to the default bootloader from the Mac / OS X. In this case, I’ll just have to hold the Option (alt) key during the initialization whenever I want to boot into Arch.
  • Arch should not interfere with OS X and vice-versa
    • Though I’ll make some experiments about OS X trying to access Linux filesystems (ext4 and/or btrfs likely) and Linux trying to access OS X filesystems, the final purpose is for each system to be quiet and don’t fiddle with the other. This means: no /etc/fstab mounts with the neighbour OS. Also, just read-only mounts while testing, for the sake of stability of both systems.
  • Purpose
    • compare battery consumption
    • analyze the experience of using Arch in an Apple hardware
    • <and etc, all the stuff you already know about the Arch way and so>
    • and, of course, this is my way to still keep connected with the Arch community, at least every now and then

Resources

When I have time I’ll write more about this. And there are still things to be done on OS X itself.

Update (2015-09-17): I’ll probably stop this series for a while. A while might last several days, weeks or months. But the good thing is it’s not finished (yet)! =P

From OS X to Arch Linux: Part #5: Prelude

From Arch Linux to OS X: Part #4

Previous post.

/tmp

https://superuser.com/questions/187071/in-mac-os-x-how-often-is-tmp-deleted

It is not deleted after every reboot…but after three unused days instead, in a cron-like manner. Interesting, huh?

In OS X, it also feels natural to use the Desktop folder as a temporary directory.

Hidden files in finder

https://apple.stackexchange.com/questions/34871/how-to-view-root-directory-and-subdirectories-in-finder

See also: man chflags.

Python

  • pip install virtualenv
    • e.g. for python2: pip -p python2 venv
      • Alternatively: pip -p $(which python2) venv
    • e.g. for python3: pip -p python3 venv

Window Management

ShiftIt looks like a nice option, however Spectacle supersedes it in a better way. Both of them are open source and they allow you to do basic window management with the keyboard. For now, I’m satisfied with Spectacle. However, there are tons of window manager wannabes out there for OS X. Most of them are paid apps — so they are not worth of your time(/money!). Though of course, we could try to get them for free anyway, but again, don’t do that, prefer to stick with the free — specially if open source too — applications instead. Here are a few additional links on that topic (warning: bloat):

Security

Index of [free] software for OS X

From Arch Linux to OS X: Part #4

From Arch Linux to OS X: Part #3: Almost there

Previous post.

Some of the data that your Mac automatically shares with Apple…

https://github.com/fix-macosx/yosemite-phone-home

And there is nothing you can really do to fix this without installing third-party programs/applications.

Startup Manager

At a first glance, it looks like systemd is easier to grasp/digest than launchd. XML for configuration files, really?? In 2015???

An overview of some commands available for the OS X command line

http://ss64.com/osx/

Pacapt: if you don’t feel comfortable using homebrew

https://github.com/icy/pacapt

Must-have homebrew packages

Install those with a simple ‘brew install <package name>’.

  • ack: easy grepping
  • autojump: easy cd
  • dtrx: abstracted extraction of compressed files
  • gdb: sometimes you need to debug your C programs
  • gnupg2: ya know
  • git
  • mercurial — why not?
  • nmap: port scanning stuff
  • p7zip
  • rcm: easy dotfiles management
  • tmux: terminal multiplexing and persistance
  • tree: for listing files
  • unrar
  • watch: for operations that need to be execute repeatedly
  • youtube-dl
  • zsh, zsh-completions and zsh-syntax-highlighting

Disclaimer: those are some of my personal preferences. Of course they may not suit your purposes.

Enable Finder ‘open terminal here’ feature

https://stackoverflow.com/questions/420456/open-terminal-here-in-mac-os-finder

Terminal.app theme

I like the base16 theme, so I could find this variant that worked well for me. I use the grml prompt as my zsh prompt, and it was horrible with Terminal.app, both with the default and the Pro theme. It worked okay with iterm2 IIRC, but since I’m using Terminal.app now, it was easier to simple change the theme. Upstream.

Some finder shortcuts

  • SPACE usually means to preview the selection
  • ENTER renames the selection
  • CMD+UP goes to the parent of the current directory
  • CMD+O opens the selection. This is what you’d intuitively think that ENTER does…alternatively, use CMD+DOWN. I find the first option slightly more intuitive, probably because of my previous vim/emacs experience. Source.

Update: Next post.

From Arch Linux to OS X: Part #3: Almost there

From Arch Linux to OS X: Part #1

Previous post of this series.

Find My Mac

If you ever lose your hardware for some reason…

https://support.apple.com/en-us/HT204756

Caveat: your location must be shared with Apple. Of course…

Wipe the Dashboard (or at least pretend to wipe it)

http://www.tekrevue.com/tip/disable-dashboard-os-x/

Really. It is entirely useless. Three things from it are available elsewhere: (a) calendar (app); (b) temperature (notifications center); (c) calculator –> python prompt!

Enable FileVault

Why, you ask?

But only if you’re a privacy/security freak like me. Also, this way you prevent a random person from just rebooting your Mac into recovery mode and then changing the default password of your account with a simple resetpassword in the terminal. By the way, Linux users are vulnerable to a similar issue if they don’t use some encryption scheme such as dm-crypt.

Note: can’t say I recommend it, but I’m testing it right now.

OS X Guide

http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html

Well curated. But you should still pay attention to what is written in there. Don’t just blindly follow all the instructions. You don’t need everything that is listed in there.

Also, the list of programs listed in the Cask part of the guide are somewhat serendipitous. In particular, I liked one called Caffeine. I also liked another one called Cheatsheet.

On mastering hotkeys…

You should definitely learn how to movement the cursor through text. Option + arrows moves by word, and options + delete deletes a world (like Ctrl+Bksp on PCs). Fn + arrow keys are also extremely useful. Last but not least, Cmd-Delete kiils a like backward (like C-w on bash).

There is much more than that, see the previous post of this series and randomly make google searches about them. What I’ll say is that after two weeks or so using this Mac, I feel I already pseudomaster the hotkeys. At least the ones I use most.

Do’s and Don’t’s: again:

  • I did a brew install coreutils but I reversed that. Gotta get used to the BSD userland.
  • It is a good idea to buy a case for your hardware.
  • Terminal.app isn’t all bad, after all. I uninstalled iterm to try to use it. However, iterm is good indeed.
  • Use Hot Corners, they are awesome!
  • I still miss tiling manager facilities. I should try spectacle and amethyst in a future post.
  • Don’t clutter your top system bar with useless indicators.
  • I still miss some stats in the system bar. Will fix that soon.
  • zsh is awesome in OS X too. Use chsh to change the default system shell to it then be happy. Of course, bash is still awesome, please leave it around if don’t want to mess with your system.
  • Some BSD applications are entirely different from their GNU counterparts. A few examples I could notice: dd, sed (gnu sed != bsd sed), tar, fdisk. You can find a few incompatibilities depending on what you might try to do with them.
  • Periodically do a brew cleanup, brew doctor and brew list for maintenance purposes.

Is this post too short for you?

What’s next?

Here are a few things I intend to do:

  • Window Management.
  • System bar information.
  • Software, software, software.
  • Linux […]
  • Server facilities.

Update: Next post.

From Arch Linux to OS X: Part #1

From rolling-release Arch Linux to OS X 10.10+: Part #0

Prelude and Off-Topic

Hello fellow readers of my not-yet-abandoned-serendipitous blog! Here is the most awaited post from the century! Before everything else, I want you to remember this word: bloat. There is another one, if you’re in the mood: temptation. This will probably be my latest series in this blog; after that, I feel it simply doesn’t make sense existing anymore. While I’m always finding something new out there in the interwebs, I feel I completed my quest of sharing my overall thoughts and opinions on technology, privacy, operating systems, usability, … and so on. After this blog/series, I should probably inquire the whereabouts of either [social] psychology or economics/politics/game theory/rationality or even dive into the unknown world of compilers: this Rust language is still in my mind for some reason, I feel I’m highly attracted and being pulled by an unknown force in this domain.

Anyway, let’s stop writing flood and go straight to the post: I will probably write about 3 or 5 posts regarding my transition to OS X. One of those posts will be a FAQ and a overall/general comparison between OS X and Linux distributions (remember, I used more than 20 linux distributions (probably), so I’m the guy who understand this !@#$ (ok, not really, but mostly).

Removing OS X Applications

http://www.cultofmac.com/90060/how-to-completely-uninstall-software-under-mac-os-x-macrx/: gotta know your system!

See also: AppCleaner. Like RevoUninstaller and EasyCleaner from the Windows World.

This is enough. More than that is manually using find + rm -rf on random places of your system. Also, you’ll want to open Activity Monitor to (maybe) find some traces of old applications. Kill them all.

Quicklook Plug-ins

https://github.com/sindresorhus/quick-look-plugins: makes the finder previewing experience better overall. Don’t install all of those, though! Just the ones you really think you’d ever use. I’d recommend using brew ask to do that. Also, do a qlmanage -r after installing those plug-ins to force quicklookd to restart. Also, don’t trust this repository at all, just use the information in there to find good plug-ins; the repositories of this guy are usually way too much overrated.

Resources

Unfortunately, I’ve already used several resources out there but didn’t index them so they are lost now. However, now that I have a nice control of my operating system, I could efficiently store a few resources. Here are they:

  • Mac Keyboard Shurtcuts (Apple Help). Comment: as an former emacs user, it is really easy to catch new keystrokes and shortcuts. It is a little harder to fixate them over time, but nothing that a little practice solves.
    • Cmd-X, Cmd-C, Cmd-V: for simple copy-and-paste operations. They are universal.
    • Cmd-Z, Cmd-S-Z: for {un,re}do operations. Universal too.
    • Well, several keys from now on are universal too and I won’t keep repeating that, so pay attention:
    • Cmd-A: Select All/Everything.
    • Cmd-F: Find.
    • Cmd-G: Find Again. Like F3 in some text editors, like C-n in Emacs, like n in vim. If you press Cmd-F again you’ll see no effect whatsoever.
    • Cmd-H hide the window from the current front app.
    • Cmd-M minimize the window front the current front app. The difference between this and the last action is subtle.
    • Cmd-O open, Cmd-S save, Cmd-P print, Cmd-N new, Cmd-Q quit. It is very nice to have those as standard. I miss this on Linux applications.
    • Cmd-Option-Esc: force quit. So I don’t need to xkill or to pkill in here. It is also possible to find this option in the apple menu.
    • Cmd-Space: spotlight! Like gnome-do, or unity search. You can use it as a launcher for apps (like dmenu or rofi) or to quickly open indexed documents on the system. Also, quickly list files with a certain extension with kind:iso, for example.
    • Spacebar: quick look. Usually available in Finder. Intended as a quick preview for some file formats.
    • Cmd-Tab: like alt tab on your favorite desktop environment.
    • Cmd-~: (cmd+shift+`): switch windows of the same app. Like Unity does.
    • Cmd-,: open preferences for the current app. This is a very nice shortcut overall.
    • Cmd-S-3: take screenshoot of the entire screen, like PrintScreen.
    • Cmd-S-4: take screenshot of a rectangle of the screen.
    • Cmd-S-Power: put the display to sleep. Alternatively, I liked setting up a hot corner on bottom left for the same purpose.
    • Cmd-O-Power: put the Mac to sleep.
    • Formatting: Cmd-B, Cmd-I, Cmd-U for bold, italic and underline.
    • Delete is actually backspace. To actually delete, use Fn+Delete. Some applications also allow you to use C-d.
    • Fn-Up: same as pageup. Fn-Down same as PageDown.
    • Cmd-Up: same as Home. Cmd-Down same as End. You could also use Fn-Left and Fn-Right.
    • Cmd-Left: move cursor to the beginning of the line (like C-a for bash). The correspondent action for the end of the line is Cmd-Right.
    • Option+{left,right}: move the cursor by word.
    • Some emacs movement keystrokes, but for documents: C-a, C-e, C-f, C-b, C-p, C-n.
  • <saving for future posts>

Do’s and Don’ts:

  • Wipe the Dashboard. This is useless.
  • Don’t install Aquamacs. So bad.
  • Don’t install MacVim. Completely useless. Use vim from within the terminal instead. Also, I’d recommend a brew install vim to get a newer version.
  • Install homebrew, and use it for command line applications! I should comment about it in a future post.
  • Install homebrew cask, but don’t abuse it!
  • Cancel all the suggestions from the Spotlight. Otherwise all of your searches will be sent to Apple servers.
  • Use Firefox, don’t use Google Chrome. Don’t infect your OS too soon!
  • Safari is okay.
  • Remove things you don’t use from the dock. Make it like eOS’s plank: KISS.
  • Learn the hotkeys of your system! They are very handy.
  • Put your display to sleep when you leave your computer. Or put the entire system to sleep if you will really leave.
  • brew install coreutils (GNU!)
  • Grab your dotfiles.
  • Configure an Apple ID, but remove your credit card immediately soon. No, you don’t want to spend money with useless apps from the app store. There are always better alternatives!
  • Install VLC. Don’t use quicktime.
  • Use quicklook as much as possible! So handy
  • Install iterm[2]. Don’t use the default terminal app.
  • <continues later on>

Wrapping up

OK, there is not much information in this post. That’s why it is called Part #0. Actually, there is more information here than I should put in such a post. But okay; I expect to be slightly more technical in the next post. See ya!

Update: Next post.

From rolling-release Arch Linux to OS X 10.10+: Part #0