Issue
I want run my script from the crontab on Mac OS, but I'm getting an error:
ruby: Operation not permitted -- /Users/vitalii/Desktop/Home/update/update.rb (LoadError)
My preferences for the cron task and settings are created using rvm cron setup
:
#sm start rvm
PATH="/Users/vitalii/.rvm/gems/ruby-2.4.1/bin:/Users/vitalii/.rvm/gems/ruby-2.4.1@global/bin:/Users/vitalii/.rvm/rubies/ruby-2.4.1/bin:/Users/vitalii/.rvm/gems/ruby-2.4.1/bin:/Users/vitalii/.rvm/gems/ruby-2.4.1@global/bin:/Users/vitalii/.rvm/rubies/ruby-2.4.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/vitalii/.rvm/bin"
GEM_HOME='/Users/vitalii/.rvm/gems/ruby-2.4.1'
GEM_PATH='/Users/vitalii/.rvm/gems/ruby-2.4.1:/Users/vitalii/.rvm/gems/ruby-2.4.1@global'
MY_RUBY_HOME='/Users/vitalii/.rvm/rubies/ruby-2.4.1'
IRBRC='/Users/vitalii/.rvm/rubies/ruby-2.4.1/.irbrc'
RUBY_VERSION='ruby-2.4.1'
#sm end rvm
* * * * * ruby /Users/vitalii/Desktop/Home/update/update.rb >> /Users/vitalii/Desktop/logfile.txt 2>&1
I gave each file the rights to execute with chmod 777
, but there are no changes and the error is repeated.
The contents of the file update.rb
are
puts 'Hello, World!!!'
Can someone tell me what's going on and what I'm doing wrong ?
Solution
I found solution, since I use Mojave.
I need to make additional settings in the system. Who would have thought ...
enter link description here
This turns out to be a problem, since you need to allow permissions for cron.
And correct run command for crontab -e, this
* * * * * /bin/bash -l -c 'ruby /Users/vitalii/Desktop/Home/update/update.rb'
Answered By - Vitalii Answer Checked By - Dawn Plyler (WPSolving Volunteer)