Mac Osx Set Default Editor For Crontab

Active7 years, 7 months ago
Mac

In Microsoft Outlook 2016 for Mac running on Mac OS X Yosemite (10.10) or later versions, you cannot set Outlook as the default application. In Outlook Preferences, under General, you enable the Make Outlook the default application for e-mail, calendar, and contacts option. You can test this by typing: crontab -e Looking beyond Mac OS X, this should work in Linux as well Change & Set the Default crontab Editor - Most hardcore command line users and unix geeks love vi, but I prefer nano.

I'm trying to get familiar with cron jobs, and I think I get the basic idea (scheduling, syntax, etc), But, I can't seem to get it right on my mac with Terminal - where exactly do I find the Crontab? How should I reference the paths to scripts?

Change Crontab Editor To Nano

What I'm trying to do is hit a php script on a remote machine (http://...) - Is that possible at all?

AdamAdam

6 Answers

To get started with launchd (instead of cron) you'll want to first create an empty .plist file, for example local.mytask.plist and put it somewhere. ~/Library/LaunchAgents is probably a good place. Open that in text editor and copy in the code below

Then 'activate' the file from the command line:

To make it load automatically, create a ~/.launchd.conf file with the same line (minus sudo launch)

Set Default Browser

The above instructions above have been copied from www.davidlanier.com and reposted here for your reference.

saschabeaumontsaschabeaumont
20.4k4 gold badges56 silver badges83 bronze badges

Type crontab -e to edit your cron table and crontab -l to list the current contents.. Type man 1 crontab for more info on that command and man 5 crontab for more info on the cron table file format.

For example, to download the stackoverflow page every day at 10:00a, run crontab -e, enter this line, and then save/quit. The output will be written to a file in your home directory.

Ryan BrightRyan Bright

On the off chance that someone else fighting with cron on Snow Leopard stumbles across this, I will dredge up this old thread.

Yes, launchd is supposed to replace cron, but in fact it can't do certain things cron can.

Cron is not integrated well. If it sends a message, it ends up in /var/mail/user_name which of course Apple Mail knows nothing about.

crontab -e throws up saying 'temp file must be edited in place'. Apparently vim is not vi compatible. You can then do crontab '< /tmp/crontab.whatever' (look in /tmp and see what name is actually used) and it will end up in the right place and, assuming you didn't make a typo, will work.

Yes, it took a while to sort this all out :(

Change Crontab Editor

CritterCritter

launchd is powerful, but you really don't want to write the plist yourself. Get Lingon. It's an open-source, really well-designed GUI for creating and managing your system's launchd tasks.

BenBen

Cron has been replaced by launchd since 10.4. You should probably write your tasks using this unless you plan on porting them to Linux/Unix systems at some point.

If you do decide to go with cron anyway, try typing crontab -e or sudo crontab -e. These will give you different crontab files, the former for the user you're currently running as and the latter for the root user.

Mac Set Default Application

'Hitting' a URL can be accomplished a lot of ways. Depending on the local script that you are using to 'hit' it, you could use some of the language's built-in methods/classes. For instance, a Ruby script would use net/http but you could try curl as well if you're just writing a bash script. Do man curl to find out more, but the basic command is just curl http://google.com.

Topher FangioTopher Fangio
13.9k14 gold badges55 silver badges86 bronze badges

You no longer want to be using cron. As others have already stated, it has been replaced by launchd and launchd is clearly going to be the future on Mac OS X.

MacTech Magazine has recently been doing a series of articles on launchd and I would highly recommend reading them. I know I have certainly learned a lot.

September, 2009 (Volume 25, Issue 9)25.09 MacEnterprise: launchd for Lunch

October 2009, (Volume 25, Issue 10)Snow Leopard, Launchd, and LunchMore launchd recipes, and a look at changes in Snow Leopard

There have been other articles in MacTech and I would suggest searching their site.

ericgericg

Set Default Search Engine

5,2774 gold badges33 silver badges60 bronze badges

Mac Os Cron

Not the answer you're looking for? Browse other questions tagged macosterminalcroncrontab or ask your own question.