Coding on FreeBSD as a JS developer (random notes)
Sublime Text
Sublime Text 3 & 4 are available via FreeBSD ports.
The Sublime Text tree view doesn't update on file changes. This might be due to inotify not being available on FreeBSD. Sublime Text 4 also has this issue. You can remedy this somewhat by using this Sublime Text extension and manually updating the tree view.
The Sublime Linter extension seems to work fine and shows errors while you are coding.
You also will need to restart Sublime Text when you change any settings or install any extensions for the changes to take affect.
Visual Studio Code
Visual Studio Code is available via ports as VSCodium.
Surprisingly the tree view for VSCode updates on file changes - perhaps they revert to polling when no other mechanism is available?
The Eslint VSCode extension works fine and shows errors while you are coding.
You will need to restart VSCode or reload the window from the command palette for a change in settings to take affect (again I think this is because it relies on inotify internally). Installing extensions don't seem to need a restart.
The Axe VSCode extension isn't supported on FreeBSD. Not a huge issue as I can use the browser extension and perhaps the cli tools.
There's a weird issue when using the VSCode debugger where it will open a duplicate version of the file the debugger/breakpoint statment is in. My fix was to switch to using node --inspect
from the command line and then using Chromium to inspect. I also installed this Chrome extension to automatically attach and open the debugger window in Chromium.
GUI Rest Client
I couldn't find a native GUI REST client (e.g. Postman) for FreeBSD, but I did find REST extensions for both VSCode and Chromium which do basically the same thing:
- https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client
- https://marketplace.visualstudio.com/items?itemName=rohinivsenthil.postcode
- https://github.com/frigus02/RESTer
- https://github.com/RESTEDClient/RESTED
- https://chrome.google.com/webstore/detail/talend-api-tester-free-ed/aejoelaoggembcahagimdiliamlcdmfm/ - Nice UI, but not open source.
npm libraries
These npm libraries I'm currently using didn't work on FreeBSD without a fix:
- playwright - fix: switched to using puppeteer
- trash-cli - fix: there is a python version that works fine on FreeBSD:
pip install trash-cli --user
- bundlesize - fix: this didnt work because it couldnt find the
python2
binary. I did have python 2.7 installed, but the binary is calledpython2.7
. People on the FreeBSD discord mentioned that I should just create a symlink like so:ln -s $(which python2.7) ~/.local/bin/python2
. After that bundlesize installed fine. - pre-commit - fix: needs to have the shebang changed in
./node_modules/pre-commit/hook
and./.git/hooks/pre-commit
. Here's a one-liner to fix a shebang:awk '$0 = NR==1 ? replace : $0' replace="\#\!\/usr\/bin\/env bash" ./.git/hooks/pre-commit > tmpfile && mv tmpfile ./.git/hooks/pre-commit
. I ended up adding the following script to mypackage.json
file so the scripts are fixed on install/reinstall of npm libs (task is an npm library i use for build tasks in my project):"scripts": { "postinstall": "[ \"$(uname)\" = 'FreeBSD' ] && task freebsd:fixprecommithooks",
Weirdly enough, the shebang issue has already been fixed by the pre-commit library authors, but it seems npm is hosting the old version of the file which is weird. I might open an issue to report it.
Geany
Geany is available on FreeBSD and is a very capable editor. It can even be used as a fairly decent Sublime Text replacement:
Unfortunately it doesnt have LSP support yet 😥. Although as an alternative, Kate is available in ports and does have LSP support built in.
Databases
All the regular databases are available - postgres, mysql, mongo, sqlite etc
Database GUI Managers
Both SqliteStudio and DB Browser for SQLite are available on FreeBSD and work fine.
DBeaver Community also runs fine on FreeBSD and can connect to most SQL databases.
There is no MongoDB GUI manager in ports, although it's possible a Linux MongoDB GUI app could work on FreeBSD via Linuxulator.
GUI Diff Programs
Meld is available in ports and works fine on FreeBSD. KDiff is also available.
GUI Hashing Client
I had a hard time finding a GUI hashing client (e.g. hash the SHA1 of a file), however I found that this windows program works just fine on FreeBSD with wine: https://www.den4b.com/products/hasher.
Electron
I was fearful that either Electron wouldn't be supported on FreeBSD or it would only support an ancient version, but as of June 23, 2020, FreeBSD has an Electron port of Electron version 12.0.9, which is only one major release behind what is currently out 👍
Offline Docs
Zeal is available.
You can also create a shortcut to DevDocs in chromium so it opens in a window and has a proper icon in the dock/taskbar. To do this, go to the file menu in Chromium, select More Tools, then Create Shortcut, and check the open in window checkbox.
Then go into the DevDocs settings and download the docs for offline use.
Evernote
There is a new version of the Evernote website that is very capable. You can make Evernote web have its own window and dock/taskbar icon by opening the file menu in Chromium, select More Tools, then Create Shortcut, and check the open in window checkbox.
If you want a keyboard shortcut to focus the Evernote window, you can use xdotool: xdotool windowactivate $(xdotool search --name "Evernote")
Graphics Programs
Gimp, Krita and Inkscape are available.
There's also https://www.photopea.com/
I couldn't find any GUI programs for image compression for FreeBSD, however the google squoosh app works offline, so you can just install that as a PWA with Chromium: https://squoosh.app/
The Mate desktop has a color picker that works fine.
Flameshot for screenshots is available.
FTP Programs
Filezilla is available.
Terminals
There are a tonne of terminals available for FreeBSD. My favourite one Guake is available too, however the one in ports seemed to be broken for me. Installing the latest one via pip install guake --user
worked a treat.
GUI Git Clients
There are a couple of very basic git gui clients available - eg Gitg, Git Cola, QGit
For the moment i am using the built in git features in VSCode. When coupled with Git Lens, VSCode becomes a very nice Git GUI client.
I did manage to get SmartGit to start by changing some things in its bash startup script (since its just a java app) but it wasn't able to use the git executable, it gave a permission denied error? - dunno what that was about
App Launchers
Albert, Ulauncher & Rofi are all available and work well.
Nodejs
The LTS version available in ports is only one patch version behind the latest.
The latest non-LTS nodejs version available in ports is one minor version behind the latest.
Python
When getting the cpu core count in Python os.cpu_count()
returns the cpu threads count and len(os.sched_getaffinity(0))
errors as sched_getaffinity is not available on FreeBSD. However int(os.popen("sysctl -n kern.smp.cores").read().split('\n')[0])
returns the correct core count.
Sed
sed
on BSD doesn't support every feature the Linux version supports. GNU sed is available via a port though: https://www.freshports.org/textproc/gsed/