Setting up Pharo Smalltalk Developer Environment
23 Jul 2019
There are a few variations of the Smalltalk programming language. I chose Pharo for no particular reason than to get started with one of them. Pharo is a pure object-oriented programming language and a development environment.
Will be updating these instructions to include setting up test cases.
The download instructions I am following can be found on Pharo's Setting up a project Github page
Install Pharo with Brew
brew cask install pharo-project/pharo/pharo-launcher
Search for PharoLauncher in finder and open it.
In the Pharo launcher
- Click on the "Official distributions" drop-down menu in the left panel and double-click on the newest version of Pharo from the list. I chose "Pharo 7.0 - 64bit (development version)".
- Enter a name for your Image. I called mine "HelloWorld". Your image should now show up in the right pane in the development environment.
- Launch the image by double-clicking on the image name. This launches the Pharo virtual machine where you can write your program.
When you launch your image, Pharo gives you the option to select a white or dark theme. I nearly missed that.
Create a package and a class
To make your first package, click on the "Tools" option in the top menu bar, and then click on "System Browser". According to the tutorial, the System Browser is the main tool to develop a project in Pharo.
The leftmost panel in the system browser shows all of the packages that already exist in your project. To create a new one, right click anywhere in the leftmost panel and choose the option "New package", which will open a new small window.
Give your package a name and click 'ok'. I called mine "Hello-World", which follows the package naming convention I observed accross the other package names. Two capitalised words seperated by a hyphen.
To create a class, click on your package name. You will see a class stub template in the panel that spans accross the bottom of the screen. Change the name of the class to your own name. In this case, I named my class 'HelloWorld'. The classname here is prefixed by a hash symbol. So when you replace the template name be sure to keep that in place.
Save your class with command-s (for Mac). After doing this you will see the middle pane of your system browser now has 'ClassName !' in it, and the panel to the right will contain 'instance side'.