Skip to content

Instantly share code, notes, and snippets.

@lafiosca
Last active June 7, 2020 00:15
Show Gist options
  • Save lafiosca/f364df0ef016b4d4888c278b0a7b70c1 to your computer and use it in GitHub Desktop.
Save lafiosca/f364df0ef016b4d4888c278b0a7b70c1 to your computer and use it in GitHub Desktop.
Installing OpenCBM and nibtools for MacOS Catalina (10.15)

Introduction

If you're trying to use a ZoomFloppy to read and write Commmodore 64 disks with a modern Mac, you'll probably want to install OpenCBM and nibtools. It can be difficult to sift through all of the software, manuals, forums, and blogs to figure out how to get that set up. I've done it on multiple machines, and most recently I had to install it on my new Mac Mini which is running the latest MacOS Catalina (10.15). I thought I would summarize my steps here for anyone else in a similar situation so that they would not have to put in as much effort as I did.

(These instructions are also available in blog article form.)

Install MacPorts

First install MacPorts if you haven't already. The MacPorts installation directions will also require you to have the Xcode command line tools installed.

The latest versions of Xcode include a non-working stub svn in the command line tools, but we need a working version for when we install nibtools from an SVN repository (see further below). There are various ways to work around this. Here are a couple of options:

Option 1: You could simply install it using the command sudo port install subversion, but that will also install a bunch of dependencies. If you are someone who does not generally use MacPorts (like me), you might not want this.

Option 2: Per this Stack Overflow answer, which refers to these release notes, you could install the Xcode command line tools to get it. Strangely, you need to remove an existing command line tools directory (which contains the non-working version), then reinstall. This may take 5-20 minutes, as it downloads content:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Prepare a working directory

Make sure you have git installed, and create a temporary working directory somewhere. For the rest of this document, we'll you're using a directory named c64 in your home directory:

mkdir ~/c64

Install opencbm

Install OpenCBM by using the following steps:

cd ~/c64
git clone https://github.com/OpenCBM/OpenCBM.git
cd OpenCBM/opencbm/ports/MacPorts
sudo port install

This should just work. If it does not, you may need to open an issue on that repository. You can tell it's been successful if the OpenCBM commands are in your path:

$ cbmctrl --version
cbmctrl version 0.4.99.99, built on Jun  6 2020 at 19:35:56

Install nibtools

After the pre-requisite OpenCBM port has been installed, you can build nibtools from its SVN repository by downloading the Portfile from this gist and using it:

cd ~/c64
mkdir nibtools
cd nibtools
cp ~/Downloads/Portfile .
sudo port install

Again this should just work, although you may see a couple ignorable warnings about opencbm not being in the port index. You can tell if it worked by seeing if the nibtools commands are in your path:

$ nibread

nibread - Commodore 1541/1571 disk image nibbler
(C) Peter Rittwage
http://c64preservation.com
Built Jun  6 2020 19:41:02

usage: nibread [options] <filename>

 -@x: Use OpenCBM device 'x' (xa1541, xum1541:0, xum1541:1, etc.)
 -D[n]: Use drive #[n]
 -e[n]: Retry reading tracks with errors [n] times
 -S[n]: Override starting track
 -E[n]: Override ending track
 -G[n]: Match track gap by [n] number of bytes (advanced users only)
 -s: Use SRQ transfer code instead of parallel (1571 only)
 -k: Disable reading of 'killer' tracks
 -d: Force default densities
 -v: Enable track matching (crude read verify)
 -I: Interactive imaging mode
 -V: Verbose (output more detailed track data)
 -h: Read halftracks
 -t: Extended parallel port tests
 -j: Use Index Hole Sensor  (1541/1571 SC+ compatible IHS)
 -x: Track Alignment Report (1541/1571 SC+ compatible IHS)
 -y: Deep Bitrate Analysis  (1541/1571 SC+ compatible IHS)
 -z: Test Index Hole Sensor (1541/1571 SC+ compatible IHS)

Clean up (optional)

When you're done, you can simply delete your working directory. The tools have been installed to your system and should not reference it.

rm -rf ~/c64

Acknowledgements

Thank you to Lallafa for creating these original articles long ago that helped me start the path to my current solution:

Thank you to Spiro Trikaliotis, Matt Dainty, and everyone else who has worked on improving the OpenCBM git repo.

Thank you to Peter Rittwage, Markus Brenner, and everyone else who has worked on nibtools, OpenCBM, and any other projects that paved the way.

PortSystem 1.0
name nibtools
version 0.5.0
categories emulators
license GPL mBSD
description nibtools disk transfer tools
long_description NIBTOOLS is a disk transfer program designed for copying original disks \
and converting into the G64 and D64 disk image formats. These disk images \
may be used on C64 emulators like VICE or CCS64 and can be transferred \
back to real disks.
platforms darwin
homepage http://c64preservation.com/
depends_build port:cc65 port:opencbm
depends_lib port:opencbm
fetch.type svn
svn.url https://c64preservation.com/svn/nibtools/trunk
worksrcdir trunk
use_configure no
build.cmd make -f GNU/Makefile CBM_LNX_PATH=/opt/local SVN=${revision}
build.target linux
livecheck.type none
destroot {
xinstall -m 755 ${worksrcpath}/nibconv ${destroot}${prefix}/bin
xinstall -m 755 ${worksrcpath}/nibread ${destroot}${prefix}/bin
xinstall -m 755 ${worksrcpath}/nibrepair ${destroot}${prefix}/bin
xinstall -m 755 ${worksrcpath}/nibscan ${destroot}${prefix}/bin
xinstall -m 755 ${worksrcpath}/nibwrite ${destroot}${prefix}/bin
file mkdir ${destroot}${prefix}/share/doc/${name}
xinstall -m 644 ${worksrcpath}/readme.txt ${destroot}${prefix}/share/doc/${name}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment