Fluidkeys

How to remove crontab lines on macOS Mojave

Since v1.1 Fluidkeys no longer uses cron to schedule an hourly task to run in the background on macOS. Instead it uses launchd.

Fluidkeys will attempt to remove itself from cron, but may run into problems. This is due to Mojave restricting applications’ ability to edit a user’s crontab.

If Fluidkeys fails to remove itself, this doc shows you how to remove these leftover lines in cron.

Try to manually remove the lines using `crontab`

Open Terminal (or iTerm) and run crontab -e. This opens a text editor where you should see the following lines that schedule Fluidkeys to run every hour:

[ ... ]
# Fluidkeys added the following line to keep you and your team's keys updated
# automatically with `fk sync`
# To configure this, edit your config file (see `ffk --help` for the location)
@hourly perl -e 'sleep int(rand(3600))' && /usr/local/bin/fk sync --cron-output
[ ... ]

Delete these lines and save the file.

At this point, you may be prompted to allow Terminal to administor your computer, in which case click OK.

If you then see…

crontab: installing new crontab

… then success, you don’t need to do anything else! 🙌

If you don’t get that permissions prompt, and instead see something like this…

crontab: installing new crontab
crontab: tmp/tmp.73516: Operation not permitted
crontab: edits left in /tmp/crontab.DFDDqyAEX1

Then that hasn’t worked 😢 You’ll have to temporarily grant permission… Read on.

Grant full-disk access to iTerm/Terminal

  1. Open System Preferences, then Security & Privacy > Privacy and select Full Disk Access A screenshot of the macOS Systems Preferences menu, with Security and Privacy highlighted

  2. Click the (+) icon to add an item to the list. You may have to unlock the panel to access this.

  3. In the search bar in the top right, type iTerm (or Terminal if you're using that instead). You should see it listed in the Finder window, like this: A screenshot of the macOS Systems Preferences menu, with Security and Privacy highlighted Select it, and click Open.

    (If you need to manually locate the files, iTerm is typically found in `Macintosh HD > Applications`, and Terminal is found in `Macintosh HD > Applications > Utilities`)

  4. You may be prompted that iTerm (or Terminal) will not have full disk access until it is quit. Click Quit now, and close all the windows.

Remove the leftover lines using `crontab`

Reopen iTerm or Terminal and run crontab -e.

Find the leftover Fluidkeys lines (shown below) and delete them and save the file.

[ ... ]
# Fluidkeys added the following line to keep you and your team's keys updated
# automatically with `fk sync`
# To configure this, edit your config file (see `ffk --help` for the location)
@hourly perl -e 'sleep int(rand(3600))' && /usr/local/bin/fk sync --cron-output
[ ... ]

You should be returned to the terminal, with a line reporting that the new crontab has been installed:

crontab: installing new crontab

Success, the lines have been removed! 😅

Revoke full-disk access to iTerm/Terminal

  1. Again, open System Preferences, then Security & Privacy > Privacy and select Full Disk Access

  2. In the list of apps on the right, click on iTerm (or Terminal if you’ve been using that), then click the (-) icon to remove the app from the list.

And you’re done. The leftover lines are gone and the permissions are set back as they were.

Still having problems? Email help@fluidkeys.com and we’ll do our best to get you up and running.