voipmeister.com voip stuff matters and more

Articles tagged with macOS

Change the default shell on macOS

Since 2019, Apple is favoring the zsh shell over Bash. The reason has not been made public, but logic dictates it is because of the licensing differences between Bash and zsh. Bash is GPL-licensed; zsh is released under the MIT-license which is less restrictive apparently. A writeup can be found here. I have been using Bash since forever and it is the default shell for all the Linux servers I manage at work. For me, it makes sense to keep using Bash on my laptops as well.

Setting the default shell to Bash

It’s not difficult to switch back to Bash when Apple -yet again- has changed the shell to zsh after a macOS update. Just open a Terminal window and type:

chsh -s /bin/bash

Verify the shell

To verify the shell has indeed changed to Bash, open a new Terminal window and type:

echo $SHELL

Example output:

/bin/bash

Depending on the shell you use, the shell prompt might also look different. Bash uses a dollar sign instead of the precentage sign used by zsh for example.

Available shells

In case you’re curious what shells are available to you, it’s easy to list them. In a Terminal window, type:

cat /etc/shells

This will produce output like:

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

Thoughts

Zsh does have advantages over Bash, some of which can be read here.

Another password manager

I was still using KeePassX 0.4.4 on my Mac. This version doesn’t support the Retina display on my Mac, but it wasn’t annoying enough to upgrade/migrate. One of my colleagues mentioned KeePassXC (https://keepassxc.org/), so I decided to give it a test drive.

Be sure to download the digest file as well and compare the digest against:

cat KeePassXC-2.2.0.dmg.DIGEST && shasum -a 256 KeePassXC-2.2.0.dmg

The result should be the same:

d5dec4a01b0fa00f36ebbd8d001ad24a1559d7f897af3d9a2fbdb339b02086bc  KeePassXC-2.2.0.dmg
d5dec4a01b0fa00f36ebbd8d001ad24a1559d7f897af3d9a2fbdb339b02086bc  KeePassXC-2.2.0.dmg

Using the macOS builtin tftp server

Should you ever need a tftp server on your macOS device, you can use the builtin tftp server:

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
sudo launchctl start com.apple.tftpd

The tftp root folder is /private/tftproot

The file /System/Library/LaunchDaemons/tftp.plist holds the configuration.

Stopping the tftp server is as easy as:

sudo launchctl unload -F /System/Library/LaunchDaemons/tftp.plist

Tested and approved’ on macOS Sierra

Using mutt on Mac OS X

Not kind of a VoIP related post, mainly posted for reference.

It is possible to use mutt on Mac OS X, You have 2 choices:

  1. Install mutt via macports
  2. Compile it yourself

Since I like to know what’s going on, I like compiling it from source. That’s what’s going to be described here. We will also look at macports to satisfy build dependencies, specifically for BerkeleyDB, which is used for the header cache. Furthermore, we’ll have a look at some nifty programs to interact with mutt.

1. Install macports

The macports project lives at http://www.macports.org, so head over there (more specific, go to http://www.macports.org/install.php to learn how to install macports on your Mac). Basically, you need to download a dmg image and mount it, after which you can install macports. After installation, the port binary lives in:

/opt/local/bin

For me, this location was added to the PATH variable after restarting (IIRC).

2. Install BerkelyDB

Next is the installation of BerkeleyDB for the header cache of mutt (which is supposed to speed up things a lot). Start the port binary as root, and install BerkeleyDB 4.7:

sudo /opt/local/bin/port
Password:
MacPorts 1.9.2
Entering interactive mode... ("help" for help, "quit" to quit)
[mutt/mutt-1.5.20] >install db47

If all went well, you’ll end up with BerkeleyDB 4.7 living in /opt/local. On to the compiling of mutt.

3. Download and extract mutt (side bar optional)

Download and extract mutt as follows:

curl -O ftp://ftp.mutt.org/mutt/devel/mutt-1.5.20.tar.gz
tar -zxpf mutt-1.5.20.tar.gz
cd mutt-1.5.20

While in the mutt directory, download and apply the sidebar patch if desired (OPTIONAL):

curl -O http://lunar-linux.org/~tchan/mutt/patch-1.5.20.sidebar.20090619.txt
patch -p1 <patch-1.5.20.sidebar.20090619.txt

Next, we need to tweak the configure script a bit, or you’ll end up with:

configure: error: You need Tokyo Cabinet, QDBM, GDBM or Berkeley DB4 for hcache

There are various suggestions to resolve this issue. None of the ones I found worked. What did work, was the tweak below (the tweak is necessary because the configure script doesn’t look for BerkeleyDB versions higher than 4.6):

vim configure

then, search for

BDB_VERSIONS="db-4 db4 db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"

and replace it with:

BDB_VERSIONS="db-4.7 db4.7 db47 db-4 db4 db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"

Please not the 4.7 variations at the beginning of the array. Now you can start compiling:

./configure --prefix=/sw --with-curses --with-regex --enable-locales-fix   --enable-pop --enable-imap --enable-smtp --with-sasl=/sw --enable-hcache --with-ssl --mandir=/sw/share/man
make
sudo make install

The software will be installed in /sw. Optionally, you may want to include this in your path or symlink from /usr/bin to binaries in /sw/bin.

References

Thanks to linsec.ca for the idea: http://linsec.ca/Using_mutt_on_OS_X

Mac OS X Snow Leopard Spotlight indexing forever

This is not really a voip related post, but I’d like to share it anyway.

Last friday, I picked up my brand new MacBook Pro (with Max OS X Snow Leopard 10.6) from the local Apple reseller. Excited with my purchase, I started using the MacBook right away (of course). I configured Mail, surfed the web and started using iChat. The MacBook was getting slower and slower and the spinning coloured wheel started to appear more and more.

The Spotlight menu revealed that the volumes on my MacBook were about to be indexed with an accompanying ‘estimating indexing time’ message. This went on and on, with no improvement whatsoever (there was never any real estimate in hours or minutes given).

A look at the ‘top’ output revealed that the mdworker processes were consuming a lot of resources, the idle percentage would typically be around 40 to 60%.

I googled and found a lot of tips, hints and what not. Reinstalling Mac OS did not solve the problem (as was indicated by postings from other people experiencing the same problem).

Stopping the indexing, deleting the Spotlight indexes and restarting Spotlight also did not solve the problem (I did find a nice shareware program to control Spotlight though, have a look at Spotless by Fix a Mac. However, just using Spotless did not fix my problem either (although I read postings from users that had success using it).

In the end, it turned out that Spotlight was probably choking on some files. I used ‘Disk Utility’ to repair the file permissions, after which Spotlight immediately started indexing.

Personally, I was a bit disappointed in Apple. Why would I need to fix file permissions on a freshly installed MacBook? I reinstalled the MacBook, installed the Applications from the accompanying DVD, installed iLife ’11 and updated it all. I really fail to see why I would need to fix any file permissions.

By the way, Spotlight indexed 100GB of data in 30 minutes and it works rather nice :-)

For those who’d like to know how Spotlight can be stopped and started from the command line (please note that you need to authenticate yourself again to gain admin privileges):

To turn Spotlight OFF for all current volumes:

sudo mdsutil -a -i off

To turn Spotlight indexing ON for all current volumes:

sudo mdsutil -a -i on

To delete the current Spotlight indexes for the master drive and start rebuilding the index for that drive:

rm -rf /.Spotlight*
sudo mdsutil -E /

As mentioned, you could use Spotless if you don’t feel comfortable at the command line interface.