Installing and Creating a Mac App for Zim Wiki

This guide walks you through installing Zim Wiki and then creating Zim.app so you can open Zim from Launchpad on Mac or keep it in your dock. Let's get started.

  1. If you don't already have Homebrew on your mac, follow these instructions to install it.

  2. In your terminal run the following to install Zim using Homebrew.
     
    brew install zim

    At this point you have Zim installed. The rest of the steps cover how to create Zim.app.

  3. Platypus is an app that takes command-line scripts and converts them into Mac apps.
    Run the following to install Platypus.

    brew install --cask platypus
    

  4. Open Platypus and use these suggested values.
     
    1. Icon: Pick any icon you like or keep the default one.
    2. App Name: Zim
    3. Script Type: Bash
    4. Script Path: choose New and put the following line inside (replacing existing sample content): 
      #!/bin/bash
      PYTHONPATH="/opt/homebrew/Cellar/zim/0.75.1/libexec/lib/python3.11/site-packages" XDG_DATA_DIRS="/opt/homebrew/share:/opt/homebrew/Cellar/zim/0.75.1/libexec/share" exec "/opt/homebrew/Cellar/zim/0.75.1/libexec/bin/zim"  "$@"
      
    5. Interface: none
    6. Identifier: Edit as you see fit
    7. Author: Edit as you see fit
    8. Version: Edit as you see fit
    9. Uncheck all checkboxes
    10. Files to be bundled into the application's Resources folder: leave blank.

  5. Click "Create App"

  6. Save zim.app to the Applications folder
Run and Enjoy!

Dealing with “No space left on device” when partition is not full

When you get the “No space left on device” error on linux, first thing you do it to check your disk space usage.  Often times you notice you still have space, so what could be wrong?

Although your partition is not nearly full, most likely you have too many small or zero-sized files on your disk. So while you have enough disk space, all your available inodes have been exhausted. 

To check this run:
df -ih
If IUse percentage is at or near 100%, then huge number of small files is the reason for “No space left on device” errors.

To find out where inodes are being used run:
echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"
After finding the directory with largest number of files, delete any unwanted files to free up some inodes. 

NOTE : If a process is using the files you are deleting, you will need a reboot to free the inodes used.

How to find out where a class is being loaded from

Sometimes you are interested in knowing where your code is getting a certain class from. Knowing this helps you with resolving conflicts.

Let's say in our ClassA, we are calling a certain API from ClassB, and that API is not functioning as we expect. We are interested to see which jar file ClassB is loaded from. To do this add the following line to you code and inspect or print the value of the returned string.

String mysteriousPath = ClassA.class.getResource("ClassB.class").openConnection().getURL().toString();