Currently I’m on my 2015 Macbook Pro with an Aura Pro X2 1TB internal drive (not sure if that changes the mounting).
I’m very new to terminal and have been looking everywhere for an explanation on why my SUDO / PKEXEC / ETC. are not working and/or there’s no directory.
I’ve been reading around and it seems the closest problem is my PATH is going to the wrong spot possibly, but I’m not sure how it happened so I can’t fix it.
> echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
> ls -l /etc/sudoers
-rwxrwxrwx 1 root wheel 1563 Mar 13 2020 /etc/sudoers
All the files that are said to not have malfunctioned like: bash_profile, etc. are not found on my computer. At least I don’t think.
If anyone could help me out that would be a blessing.
Commands are case-sensitive. Most commands (if not all) are in lowercase, meaning it's sudo and not SUDO.
Related
I'm using OSX Mojave and I've been wanting to use the at command to run scripts at certain times, but I've discovered that I need to change its plist file in order to use it. Right now, one of the attributes in it is Disabled=true which of course, isn't what I want.
I've gone to the ends of the earth to try to change that. I tried XCode, Pref Setter, chmod, chown, vim, and doing all of that in root. No matter what, it always says, "readonly file" or "You do not have permission."
Are plists supposed to be immutable? I'm pretty sure they aren't. Here is some of the things I've tried.
~root# id
uid=0(root) gid=0(wheel) groups=0(wheel ...
~root# atrun=/System/Library/LaunchDaemons/com.apple.atrun.plist
~root# chmod 777 $atrun
chmod: Unable to change file mode on
/System/Library/LaunchDaemons/com.apple.atrun.plist: Operation not permitted
~root# ls -l $atrun
-rw-r--r-- 1 root wheel 444 Aug 22 23:11 /System/Library/LaunchDaemons/com.apple.atrun.plist
Make a copy of com.apple.atrun.plist from /System/Library/LaunchDaemons
into your home directory or wherever you want to work on it.
Open com.apple.atrun.plist with Xcode and the settings will show up in user readable form.
Change the setting for "Disabled" from 1 to 0 then save and exit Xcode
Copy your changed com.apple.atrun.plist file to /Library/LaunchDaemons
This can be manually launched to enable batch.
On the command line, I can type edit <folder/file name> and it will open in TextWrangler, which I haven't used in ages. I'm not sure how the edit binary got there — I use oh-my-zsh, potentially relevant. I wanted to change subl to edit (nicer to type) and discovered it already existed.
I uninstalled TextWrangler and now I get the error
edit: error: -10814
LaunchServices could not locate your copy of TextWrangler.
I've been looking around for how to modify the LaunchServices database and I've rebuilt it but I still get the error. Running which edit gives me /usr/local/bin/edit fwiw.
What controls this association and how can I switch it to Sublime Text?
If you were to run ls -al /usr/local/bin/edit you'd see this:
lrwxr-xr-x 1 root wheel 52 Apr 15 2012 /usr/local/bin/edit -> /Applications/TextWrangler.app/Contents/Helpers/edit
Therefore, it looks like edit is a built-in command-line program for TextWrangler, just like subl is for Sublime, or mate is for TextMate. Of course, there's nothing stopping you from deleting the symlink, then making a new one pointing to subl if you want to.
To switch, you can run the following commands:
rm /usr/local/bin/edit
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/edit
In my case, I had replaced TextWrangler for BBEdit, so I just did those commands but with /Applications/BBEdit.app/Contents/Helpers/bbedit_tool instead of the Sublime (subl) one.
I'm working on getting GIT installed so starting to use my terminal more.
Noticed something odd though. The word localhost:~ before my username
so localhost:~ username$
Is this something I need to be worried about? Just I'm following some tutorials and all of them so far just have the user name like
username$
Done a bit of searching and found nothing on this so far and just wanted to check before I move on any further.
Thanks
using osx 10.8.5
Nothing to worry about. localhost is the name of your machine, followed by :, followed by the directory you're in, in this case ~, which is your home directory.
I'm new to mac with not familiar on terminal command, i put the dvtcolorconvert.rb file on root directory of my volume, this ruby script can converting xcode 3 themes into xcode 4 themes format, which is xxxxxxxx.dvtcolortheme format.
Then run the script /dvtcolorconvert.rb ~/Themes/ObsidianCode.xccolortheme on terminal, but it's always prompt "Permission denied".
what's wrong with this? Anybody can help me solve this problem? Thanks.
Did you give yourself the rights to execute the script?
The following command as super user will do this for you:
sudo chmod 755 'filename'
For details you should read the man page of chmod.
Please read the whole answer before attempting to run with sudo
Try running sudo /dvtcolorconvert.rb ~/Themes/ObsidianCode.xccolortheme
The sudo command executes the commands which follow it with 'superuser' or 'root' privileges. This should allow you to execute almost anything from the command line. That said, DON'T DO THIS! If you are running a script on your computer and don't need it to access core components of your operating system (I'm guessing you're not since you are invoking the script on something inside your home directory (~/)), then it should be running from your home directory, ie:
~/dvtcolorconvert.rb ~/Themes/ObsidianCode.xccolortheme
Move it to ~/ or a sub directory and execute from there. You should never have permission issues there and there wont be a risk of it accessing or modifying anything critical to your OS.
If you are still having problems you can check the permissions on the file by running ls -l while in the same directory as the ruby script. You will get something like this:
$ ls -l
total 13
drwxr-xr-x 4 or019268 Administ 12288 Apr 10 18:14 TestWizard
drwxr-xr-x 4 or019268 Administ 4096 Aug 27 12:41 Wizard.Controls
drwxr-xr-x 5 or019268 Administ 8192 Sep 5 00:03 Wizard.UI
-rw-r--r-- 1 or019268 Administ 1375 Sep 5 00:03 readme.txt
You will notice that the readme.txt file says -rw-r--r-- on the left. This shows the permissions for that file. The 9 characters from the right can be split into groups of 3 characters of 'rwx' (read, write, execute). If I want to add execute rights to this file I would execute chmod 755 readme.txt and that permissions portion would become rwxr-xr-x. I can now execute this file if I want to by running ./readme.txt (./ tells the bash to look in the current directory for the intended command rather that search the $PATH variable).
schluchc alludes to looking at the man page for chmod, do this by running man chmod. This is the best way to get documentation on a given command, man <command>
In my case, I had made a stupid typo in the shebang.
So in case someone else on with fat fingers stumbles across this question:
Whoops: #!/usr/local/bin ruby
I meant to write: #!/usr/bin/env ruby
The vague error ZSH gives sent me down the wrong path:
ZSH: zsh: permission denied: ./foo.rb
Bash: bash: ./foo.rb: /usr/local/bin: bad interpreter: Permission denied
You should run the script as 'superuser', just add 'sudo' in front of the command and type your password when prompted.
So try:
sudo /dvtcolorconvert.rb ~/Themes/ObsidianCode.xccolortheme
If this doesn't work, try adapting the permissions:
sudo chmod 755 /dvtcolorconvert.rb
sudo chmod 755 ~/Themes/ObsidianCode.xccolortheme
To run in the administrator mode in mac
sudo su
use source before file name,,
like my file which i want to run from terminal is ./jay/bin/activate
so i used command "source ./jay/bin/activate"
Check the permissions on your Ruby script (may not have execute permission), your theme file and directory (in case it can't read the theme or tries to create other themes in there), and the directory you're in when you run the script (in case it makes temporary files in the current directory rather then /tmp).
Any one of them could be causing you grief.
I want to run a shell script on startup
by google ,I found that I could add shell in rc.common
so I added the code below at the end of rc.common
is it a permission problem?
## rc.common test ##
touch ~/test.txt
reboot,there is no test.txt in my user fold
when I test it in terminal manualy ,it's ok
ls -l /etc/rc.common
-rw-r--r-- 1 guirong wheel 1737 3 30 22:36 /etc/rc.common
where is the problem? my system verison is 10.7.3
is it not ran by default in os x?
Just as an added bit of information about what was happening; /etc/rc.common runs as root, so when you were touching the file at ~/test.txt it would have been ending up in /var/root (the root user's home directory)
If you want the script to be run only for the current user, you should use ~/.bashrc instead
Later edit: I misread your question. If you want something to run at startup, you should look into launchd here