====== Mac OS X ======
A collection of things I tend to run into when working with Mac OS X, or macOS as Apple likes to call it these days.
===== MacPorts =====
[[https://macports.org/|MacPorts]] is by far the most important thing you should have installed on any Mac, be it brand new or PowerPC-based. It's the first bit of software that will always get installed whenever Mac OS X boots up for the first time. It's an impressive package manager for macOS that allows you to conveniently install packages into your system as in any BSD or Linux distribution.
==== gcc cannot be built ====
Having to build ''clang'' or ''gcc'' is almost unavoidable if you're running MacPorts, but I've recently come across an issue on some of my systems that whenever I got to perform a ''port upgrade outdated'' the upgrade process is halted due to an issue while building ''gcc'':
Error: gcc7 cannot be built while libunwind-headers is active.
Error: Please forcibly deactivate libunwind-headers, e.g. by running:
Error:
Error: sudo port -f deactivate libunwind-headers
Error:
Error: Then try again. You can reactivate libunwind-headers again later.
Error: Failed to configure gcc7: libunwind-headers is active
This is a [[https://trac.macports.org/ticket/57198|known issue]] and is related to some quirks when initially setting up the system. In order to get past this without breaking your system simply uninstall the ''libunwind-headers'' package and resume the last operation.
===== Version specific =====
Some quirks that are only important if you are running a specific version of the operating system or a specific architecture.
==== OS X 10.5 Leopard ====
The proper version of Mac OS X to run if you have a G5 Mac. It can run on G4s, but it's not suited for it, although [[http://www.macintoshrepository.org/39027-sorbet-leopard|Sorbet Leopard]] is now an option.
=== InterWebPPC ===
Since the demise of [[https://www.floodgap.com/software/tenfourfox/|TenFourFox]] the [[https://forums.macrumors.com/threads/interwebppc-browser-a-rebrand-of-tenfourfox-for-the-future.2292691/|InterWebPPC]] project was created, aiming to continue the work of the amazing TenFourFox effort. It's the browser of choice for having an "enjoyable" experience, although it's impossible to have an enjoyable experience in the modern web, even if you're using the latest version of Chrome. Don't forget to install [[https://noscript.net/download/releases/noscript-5.1.9.xpi|NoScript]] to keep the CPU usage low.
=== iTerm color profiles ===
Having a proper terminal is a must for me. The terminal that comes with Mac OS X, to this day, is useless, so [[https://iterm2.com/|iTerm]] comes to the rescue. The problem is that every cool theme out there (specially my favorite Tomorrow Night) is made for newer versions of iTerm2, not the [[https://iterm2.com/downloads/stable/iTerm2_v2_0-LeopardPPC.zip|version we have available for Leopard]]. In order to convert the new color profiles to use in the old version I've created a Perl script:
#!/usr/bin/env perl
### fix-itermcolors.pl
### Converts an iTerm2 color profile made for newer versions of iTerm to work
### in iTerm2 version 2.0 for OS X Leopard.
###
### Author: Nathan Campos
use strict;
use warnings;
use autodie;
# Slurps the file.
sub slurp {
my ($fname) = @_;
open my $fh, '<', $fname;
local $/ = undef;
my $data = <$fh>;
close $fh;
return $data;
}
# Read the iTerm color profile.
my $plist = slurp($ARGV[0]);
# Strip out invalid keys.
$plist =~ s/\s+Alpha Component<\/key>[^\/]+.+//g;
$plist =~ s/\s+Color Space<\/key>[^\/]+.+//g;
# Remove invalid dictionaries.
$plist =~ s/\s+Badge Color<\/key>((?!<\/dict>)[\s\S])*<\/dict>\s?//gs;
$plist =~ s/\s+Cursor Guide Color<\/key>((?!<\/dict>)[\s\S])*<\/dict>\s?//gs;
$plist =~ s/\s+Link Color<\/key>((?!<\/dict>)[\s\S])*<\/dict>\s?//gs;
$plist =~ s/\s+Tab Color<\/key>((?!<\/dict>)[\s\S])*<\/dict>\s?//gs;
# Print it out.
print $plist;
To use this script, for example to convert the awesome Nord color profile:
./fix-itermcolors.pl Downloads/Nord.itermcolors > Nord.itermcolor
Now you should have a color profile ready to import into iTerm.
==== PowerPC ====
The good old days of Apple, when things ran hot, felt like bricks, and were amazingly unique. This is the best era of Apple if you are looking to have some fun with computers while feeling quirky.
=== Installing vim ===
''Vim'' is my preferred text editor. It's even [[https://ports.macports.org/port/vim/details/|packaged in MacPorts]], although the version that is packaged there is way too new and requires [[https://en.wikipedia.org/wiki/Grand_Central_Dispatch|Grand Central Dispatch]]. If you try to install it you'll get the following error when building:
:info:build /opt/local/bin/gcc-apple-4.2 -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG
_H -I/opt/local/include -DMACOS_X -DMACOS_X_DARWIN -pipe -Os -arch ppc -D_REE
NTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/alloc.o alloc.c
:info:build In file included from vim.h:283,
:info:build from alloc.c:14:
:info:build os_mac.h:273:32: error: dispatch/dispatch.h: No such file or directo
ry
:info:build In file included from vim.h:283,
:info:build from alloc.c:14:
:info:build os_mac.h:295: error: expected specifier-qualifier-list before 'dispa
tch_queue_t'
:info:build In file included from vim.h:2266,
:info:build from alloc.c:14:
:info:build proto.h:125: warning: 'cold' attribute directive ignored
:info:build proto.h:132: warning: 'cold' attribute directive ignored
:info:build proto.h:135: warning: 'cold' attribute directive ignored
:info:build make[1]: *** [objects/alloc.o] Error 1
In order to install vim we'll need to fetch the source code and compile it manually. Ensure that you have updated the ''openssh'', ''openssl'', and ''git'' packages from MacPorts (it takes a very long time to compile the GNU toolchain on PowerPC, but it's worth it), you'll need them to fetch the source from ''vim'''s [[https://github.com/vim/vim|GitHub repository]]. The latest version I was able to compile was ''7.4.2367'':
git clone --depth 1 --branch v7.4.2367 https://github.com/vim/vim.git
cd vim
./configure \
--disable-gui \
--without-x \
--without-local-dir \
--disable-gpm \
--with-tlib=ncurses \
--enable-multibyte \
--enable-fail-if-missing \
--with-compiledby="Innove Workshop" \
--with-features=huge
make
sudo make install
Now you should have a quite modern version of ''vim'' to use on your PowerPC workstation.