C64 Bash login in OS X

Something somebody had posted to Facebook a few days ago caught my attention. It was a way of modifying the default bash login screen to make it look like the initial screen you see when you power on a Commodore 64. The page linked to was this one, but I thought it could be improved upon.

Oh, and for anybody who doesn’t know, bash is the Unix shell, and called Terminal in Mac OS X.

For starters, the C64Pro typeface is a better match, so I used that, and then I got to thinking it would be cool if the script actually reported the installed RAM of the host computer in KB, and presented the ‘free’ RAM in bytes, both mirroring the original C64 screen.

To edit the default login screen for your user account, open a bash shell and type:

sudo nano .bash_profile

And here’s the revised script you need to place into that profile:

export PS1=$
free="$(( $(vm_stat | awk '/free/ {gsub(/\./, "", $3); print $3}') * 4096 * 2)) BASIC BYTES FREE"
echo "         "\*\*\*\* BASH $BASH_VERSION \*\*\*\*
mem=$(sysctl hw.memsize )
mem=$( awk '{printf("%s",$2)}' <<< $mem )
echo " "$mem"K RAM SYSTEM " $free
echo READY.

You also need to change your default Terminal profile within the preferences to alter the colours and replace the font. I used these:

Deep blue: #4400FF
Light blue: #9C92F8
Selection: #D2D2FF

Have fun! Oh, and here’s what the original screen looks like for anyone who’s never seen it before:


2 thoughts on “C64 Bash login in OS X

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s