I started playing around using Retro68 on a modern Linux-based machine to do development work for old Macintosh computers in the spirit of one of my previous posts. In doing so, I ran into many problems while getting started and coming up with my own workflow. I hope that others can find this guide helpful in getting up and running with their own classic Macintosh dev stories.
Who can use this guide? Anyone who wants to get up and running with Mac development being cross compiled from a modern Linux environment as quickly as possible. I’ve laid out the commands and explanations in the most straightforward way I could with the simple goal of running a hello world application. I do not go very in depth as to what I am laying out here but link out to other resources for you to learn more.
I used a few other guides to build up to what I ultimately wound up using for my development workflow. You should read them if you get stuck or are interested in further reading:
- Developing vintage 68K Macintosh apps with CodeLite IDE, Retro68 and pce-macplus emulator - this is hands down the best guide I have seen and what I base most of this workflow on
- PCE/macplus, the ultimate 68K Macintosh emulator
- Exploring Retro68 GCC-based SDK for 68K Macintosh computers
- Retro68 GitHub
I used Ubuntu running on an intel-based Mac Mini for my build environment. To run the complete toolchain that I’ll outline in this post and several other following posts, you’ll need a Linux-based environment as that is the only way I’m aware of to make full use of pce-macplus’s serial port. I’ve additionally tested running though this guide on an ARM64 Ubuntu 20 VM using UTM on an M1 Mac Mini. Off we go…
There are complete instructions and in-depth available online already, these are abridged for Ubuntu between the toughdev and Retro68 docs:
First ensure prereqs are installed:
sudo apt-get install cmake libgmp-dev libmpfr-dev libmpc-dev libboost-all-dev bison flex texinfo ruby g++ hfsutils
Then clone the Retro68 git repo:
git clone https://github.com/autc04/Retro68.git
Get the MPW includes downloaded and in place:
Now build Retro68:
If everything went well, you should now have a functional Retro68 environment! Back to that in a bit…
One of the motivations here is that we have full serial communication to enable the development of software utilizing the serial port on the Macintosh for bidirectional communication. Check out one of my other posts here for more information. We emulate that locally with
tty0tty. This step is marked as optional, because if you don’t care about working with CoprocessorJS you may not need this step.
git clone https://github.com/freemed/tty0tty
note! I got a build error on my most recent test with these instructions.
You should now have functional fake serial port pairs at
/dev/tnt0 is linked to
note: you may have to do this after every reboot. Some of the tty0tty docs describe how to persist across reboots but I haven’t been able to get that working and also haven’t spent much time on it.
pce-macplus is the emulator environment we’re going to use. Again, complete instructions are available here.
We choose pce-macplus because it emulates full serial communication and works well on Linux. To run pce-macplus on latest Ubuntu, we need to compile it ourselves. We’ll do that with the following:
First we need some prereqs:
sudo apt-get install libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev libsdl1.2-dev libsdl1.2debian
Then we’ll download and install pce-macplus:
Download a sample application to start working with. There are some included in Retro68 that you can try out or you can continue on to try one of mine. I recommend https://github.com/CamHenlin/nuklear-quickdraw as a Macintosh project base and I will use it as the example here as I know it will function in this environment.
git clone https://github.com/CamHenlin/nuklear-quickdraw
We’re about ready to start coding. VSCode is a great place to do development work on Retro68 projects. You want to add this to your
includePath setting to get code completion on Mac-specific libraries. VSCode should prompt you to import the
includePath the first time you open your project:
We have code in place. We have everything set up. Now we just need a few convenience scripts in place to run our code for us. From this ToughDev article we can get a set of scripts to help us out. I’ve conveniently cloned them and edited them to work with the directory structure outlined here. The other set of files that we need to retrieve is the pre-built configuration for pce-macplus:
Now that we have our hello world app in place, we should be able to run our project for the first time. Assuming you started with the
nuklear-quickdraw project listed above, try:
This should compile your code, launch the pce-macplus VM with its printer serial port pointed at
~/pce-mac-classic/ser_b.out and its modem port pointed at
/dev/tnt1 (which will be bi-directional with
I am going to outline my own personal workflow here. Everyone’s preferences are a bit different here so take this and modify it to suit your own needs:
For coding, I use VSCode for everything. I like to open the entire project directory (like
nuklear-quickdraw for example.) VSCode offers good autocomplete support and is fast and usable.
Retro68 offers no debugging capabilities from what I can tell which poses a bit of a problem. If you google around, you’ll probably find people telling you to use CodeWarrior or ThinkC if you want a debugger. What we can do is log output (as identified by this article) over the serial port.
nuklear-quickdraw for example, I implemented the same
writeSerialPort function as outlined in this ToughDev article). You can use it like this:
In your code:
writeSerialPort(boutRefNum, "my test output");
my test output will be appended to
~/pce-mac-classic/ser_b.out any time that code is called.
I recommend always having one terminal window open and tailing
note: if you leave any logging code in place when you take your program to a physical Mac, it will be dumping data out the printer serial port to whatever is hooked up to it!
See my other post here regarding profiling your Retro68 application.
nuklear-quickdraw contains example profiling code.
Any time you’re ready to run new code, just use the line that we used to test our hello world application earlier:
I like to keep a terminal window open just for this use case.
Did you enjoy my post?
I'm really excited about the work that I'm doing here. If you enjoyed my post and my work, please consider tipping me with a coffee. I appreciate you taking the time to read my post!