Mac os file permission denied

Содержание
  1. Change permissions for files, folders or disks on Mac
  2. Assign permissions to users and groups
  3. Apply permissions to all items in a folder or a disk
  4. Change an item’s owner
  5. Add or remove a user or group in the Name column
  6. How to Fix Permission Denied in Terminal Mac
  7. Zsh Permission Denied Mac
  8. Some “Permission Denied” Error Examples:
  9. What Is MacOS Terminal?
  10. Opening the Terminal App on Mac
  11. via the Applications Folder
  12. via Spotlight
  13. Customizing the Terminal App
  14. Basic Mac Commands You Need to Be Familiar With
  15. Some Advanced Commands to Use on the Terminal Command Line
  16. Copying Files from One Folder to Another
  17. Downloading Files from the Web
  18. Changing the Default Location of Screenshots
  19. Changing the Default File Type of Screenshots
  20. Deleting All Files in a Directory
  21. What Is Zsh?
  22. What Is Permission Denied in Terminal to Open a File?
  23. Why You’re Getting “Permission Denied” Error in Mac
  24. The File Is Locked
  25. Insufficient File Permission
  26. Incorrect Chmod X or System Command
  27. How to Fix Permission Denied Error in Mac
  28. Step 1: Check your permissions.
  29. Step 2: Change the ownership of the directory.
  30. Step 3: Give Terminal full access to the disk.
  31. Step 4: Use SUDO commands.
  32. Other Ways to Resolve the Zsh Permission Denied Error in Mac
  33. Solution #1: Download Oh My Zsh
  34. Solution #2: Configure the .zshrc File
  35. Solution #3: Change the Theme of the Terminal App
  36. Solution #4: Change the Default Shell of Your System
  37. How to Avoid Permission Issues on Your Mac
  38. Method #1: Assign Permissions to Users and Groups
  39. Method #2: Apply Permissions to All Items
  40. Method #3: Change the Item’s Owner
  41. Method #4: Add or Remove a User or Group
  42. Summary

Change permissions for files, folders or disks on Mac

Permission settings determine who can view and alter files on the computer. You change permission settings at the bottom of the Info window for a file, folder or disk in the Finder. For example, you can change permission settings for a folder so that other users who log in to your Mac, or connect to it for file sharing, can view but not change files in a folder.

Assign permissions to users and groups

On your Mac, select a disk, folder or file, then choose File > Get Info.

If the information in Sharing & Permissions isn’t visible, click the arrow .

If the lock at the bottom right is locked , click it to unlock the Get Info options, then enter an administrator name and password.

Click a user or group in the Name column, then choose a privilege setting from the pop-up menu.

Read & Write: Allows a user to open the item and change it.

Read only: Allows a user to open the item but not change its contents.

Write only (Drop Box): Makes a folder into a drop box. Users can copy items to the drop box, but can’t open it. Only the owner of the drop box can open it.

No Access: Blocks all access to the item.

You can undo any changes to privilege settings for a user or group in the Sharing & Permissions section since opening the Info window. Before closing the Info window, click the Action pop-up menu , then choose “Revert changes”.

Apply permissions to all items in a folder or a disk

On your Mac, select a folder or disk, then choose File > Get Info.

If the lock at the bottom right is locked , click it to unlock the Get Info options, then enter an administrator name and password.

Click the Action pop-up menu , then choose “Apply to enclosed items”.

Change an item’s owner

On your Mac, select the item, then choose File > Get Info.

If the lock at the bottom right is locked , click it to unlock the Get Info options, then enter an administrator name and password.

If the new owner’s name isn’t listed in the Name column in the Sharing & Permissions section, click the Add button to add the new owner.

Select the new owner in the Name column, click the Action pop-up menu , then choose “Make __ the owner”.

You can undo any changes to an item’s owner in the Sharing & Permissions section since opening the Info window. Before closing the Info window, click the Action pop-up menu , then choose “Revert changes”.

Add or remove a user or group in the Name column

On your Mac, select an item, then choose File > Get Info.

If the lock at the bottom right is locked , click it to unlock the Get Info options, then enter an administrator name and password.

In the Sharing & Permissions section, do any of the following:

Add a user or group: Click the Add button below the list, select a user or group, then click Select.

Remove a user or group: Select the user or group, then click the Remove button below the list.

You can undo adding or removing a user or group in the Sharing & Permissions section since opening the Info window. Before closing the Info window, click the Action pop-up menu , then choose “Revert changes”.

Источник

How to Fix Permission Denied in Terminal Mac

Download and try Outbyte MacAries right now to see what it can do for your Mac.

Developed for macOS

Zsh Permission Denied Mac

Opening a file in macOS is quite easy. You just need to double-click on it — and voila! It shouldn’t take long to open a file on your Mac.

Another way to open a file is via Terminal. Just run a command and set the directory where the file is saved and you should be able to open it without any hassle.

Unfortunately, that’s not always the case. There have been instances when the Terminal is getting the “permission denied” error in Mac when opening a file. A simple command shouldn’t give out this error. This only means that there is something wrong with either your file or macOS itself.

Читайте также:  Все репозитории для астра линукс

Some “Permission Denied” Error Examples:

Like the errors with permissions on Windows devices, the permission denied error on Macs may come with various error messages. Below are some examples:

Pro Tip: Scan your Mac for performance issues, junk files, harmful apps, and security threats
that can cause system issues or slow performance.

  • zsh: permission denied: ./foo.rb
  • Bash: bash: ./foo.rb: /usr/local/bin: bad interpreter: Permission denied
  • aftheers-MacBook-Air:scripts root# ./ArduinoWifiShield_upgrade.sh
  • -sh: ./ArduinoWifiShield_upgrade.sh: Permission denied

This is a common error that has been hounding Mac users for a long time. It is not something new, but there have been several reports recently of Mac users getting “permission denied” error in Mac after upgrading to Catalina and Big Sur.

There are a lot of things that could go wrong when you run a command in Terminal, so encountering this error is not surprising. But this error can still be very annoying, especially if you have no other way to open the file.

For instance, you want to open a file with no associated program or does not respond to clicks.

Before we discuss everything about the Zsh permission denied error on the command line of your Mac OS device, let us define the basic terms first.

What Is MacOS Terminal?

Mac’s Terminal app allows you to do a multitude of things. However, it is widely used to control your device by using various commands.

This app is a Mac command line interface. For some, this may be quite tricky to work with. But for others, it makes completing tasks a breeze. To use it, you simply have to be familiar with basic functions and commands and enter them into the command line.

Once you’ve mastered them, you can dig deeper and explore more advanced command to complete more complex tasks.

Opening the Terminal App on Mac

There are two ways to open the Terminal app on your Mac.

via the Applications Folder

This app is located in the Utilities folder under Applications. To launch it, open your Applications folder and select Utilities. After that, double-click on the Terminal app.

via Spotlight

Alternatively, you can press the Command key and the Space bar. This will launch Spotlight. Here, type terminal and double-click on the search result.

Customizing the Terminal App

Now, you will see a small window with a plain white background. You will see your username in the title bar. Also, the word “bash” and the dimensions of the active window in pixels are displayed.

Should you want to make the window bigger, simply click the bottom right corner of the window and drag it outwards.

If you wish to change the colors of the background and the font, open the Shell menu and select New Window. From here, you can select the best option from the list.

Basic Mac Commands You Need to Be Familiar With

The best and quickest way to be familiar with the Terminal app is to start using it. But before you can proceed with that, you have to be familiar with how to enter a command. Well, that is easy because you just have to type the command at the command line and hit Return to execute it.

Each command has three elements: the command, an argument that tells that command what resource/s it should be running on, and an option that allows you to modify the output.

For instance, if you want to move a system file from one folder to another, you have to use the move command “mv” and type the location where you want to move the file.

Some Advanced Commands to Use on the Terminal Command Line

Here are a few examples of more advanced Terminal commands:

Copying Files from One Folder to Another

To copy files from one directory to another directory, follow these steps:

  1. Type the ditto [folder1] [folder2] command into the command line. Change the value of folder1 to the folder that hosts the current files. Folder2 should be the folder where you want to move them.
  2. To view the files being copied, type -v after the command.

Downloading Files from the Web

To download files from the web using the Terminal app, do the following:

    Open the Terminal app and type the cd

/Downloads/ command.

  • And then, input this command: curl -O [URL of file you want to download].
  • Changing the Default Location of Screenshots

    If you want to change the default location where you want to save your screenshots, follow these steps:

    1. Type this command into the command line: defaults write com.apple.screencapture location [path to folder where you want screenshots to be saved].
    2. Press the Return key.
    3. Next, type this command: killall SystemUIServer.
    4. Hit the Return key once again.

    Changing the Default File Type of Screenshots

    If you want to save your screenshots in .jpg format, here’s what you should do:

    1. By default, Mac screenshots are saved using the .png file extension. To change this to .jpg, type this command: defaults write com.apple.screencapture type JPG.
    2. Press the Return key.
    3. And then, type this command: killall SystemUIServer.
    4. Press the Return key once again.

    Deleting All Files in a Directory

    To delete folders and sub-folders in a directory, do this:

    1. To delete all the files in a directory, type this command: rm -R directoryname.
    2. Confirm the deletion by using this command: rm -iR directoryname.

    What Is Zsh?

    The Z shell or the Zsh is a Unix shell that is designed and built on top of bash — macOS’ default shell. Experts recommend using zsh over bash because it is so much easier to use when configuring plugins and themes. Also, its themes look more beautiful and neat. Most importantly, it doesn’t require strict user permissions.

    What Is Permission Denied in Terminal to Open a File?

    Just like what the name says, this is a permission error that prevents Mac users from opening a file using commands. It can occur with sudo commands or even bash commands. According to several reports, the Permission Denied error can also happen even when the file is being opened in root.

    Most of the reports say that the error appears when they are trying to open the file installer via Terminal. When the file is dragged to the Terminal window, the “Permission Denied” error pops up. However, this can also happen with any other file.

    Why You’re Getting “Permission Denied” Error in Mac

    There are many possible reasons why you’re getting the Zsh permission denied error on your device. The most common ones are as follows:

    The File Is Locked

    You will most likely encounter the “Permission Denied” error if you are trying to install a program or modify a file that is locked. It could be because you do not have administrator privileges or because the creator of the file used chmod to lock the file.

    This error is an indication that your command is attempting to write to a directory that your user account does not own.

    Insufficient File Permission

    You can check the permissions of the file in question by typing in ls -l file.ext in the Terminal. The “file.ext” represents the file and extension of the file you’re trying to open or modify. You can also try to force a command that requires administrator permission using “sudo”.

    Incorrect Chmod X or System Command

    Another reason you are getting this error is that you probably entered an incorrect chmod x or other system commands.

    Check for errors in your syntax and make sure you’re trying to use the right command. If you’re trying to run an application, make sure that the program command is valid and installed on your computer.

    How to Fix Permission Denied Error in Mac

    When you’re getting this error, the first thing you need to do is try to open the file using the normal method. Double-click on the file to see if you are able to open it. If you’re not successful, then you can try some of the solutions below.

    After that, make copies of any relevant files you have. You might need a backup file later in case anything goes wrong. After all, when you try to force a command to work, there are potential downsides that could mess up your system and result in more problems. It’s better that you come prepared.

    Also, make sure to optimize your Mac using Mac repair app to prevent other issues from popping up. It would also clean up your system to make your processes run smoothly. Once done, restart your Mac and check out our troubleshooting guide.

    Step 1: Check your permissions.

    As mentioned earlier, this error usually happens because you do not have sufficient permissions to access the file. To check whether this is the case:

    1. Launch Terminal from Utilities.
    2. Type the following command, and add a space after the final character. DO NOT press Enter: ls -l
    3. Drag the file you want to open and drop it into the Terminal window. This will automatically append the file’s location to the existing command. However, this will not actually move the file.
    4. Now click on the Terminal window and press Enter.

    This will show you whether you have permission to write or modify the file.

    Step 2: Change the ownership of the directory.

    Take ownership of the directory with the chown command before attempting to write to it.

    You can enter this command in Terminal, then press Enter: chown -R $USER:$USER /path/to/directory

    Change $USER with the current logged in user and /path/to/directory with the path to where you want to write to.

    Step 3: Give Terminal full access to the disk.

    It is also possible that the Terminal does not complete access to the disk, which is why you can’t open the file using commands. To fix this, go to System Preferences > Security & Privacy > Privacy panel, then add Terminal to the list of apps that are able to control your computer.

    Step 4: Use SUDO commands.

    Sudo may be simple but it is powerful enough to allow you to run commands with administrator privilege. So, if you have encountered denied commands caused by permission issues, then enter sudo.

    The sudo command executes the commands that follow its superuser or root privileges. This command should allow you to execute almost any command from the Terminal. To do this, simply add sudo before the original command. Here are sample commands:

    • sudo chmod 755 /dvtcolorconvert.rb
    • sudo chmod 755

    You will be prompted to enter your password if this is your first time using the sudo command. But after that, you won’t have to enter it every time you use a sudo command.

    Other Ways to Resolve the Zsh Permission Denied Error in Mac

    If you are still getting the Zsh permission denied error on your Mac while trying to open a file on macOS Catalina or other versions, fret not. Here are other solutions you can try:

    Solution #1: Download Oh My Zsh

    Sometimes, the Zsh permission denied error can be resolved by trying to improve your existing Terminal app. One way to do so is by using Oh My Zsh.

    Oh My Zsh is an open-source, user-friendly, and community-driven framework that can be used to manage Zsh configurations on MacOS Catalina or other macOS versions. It comes bundled with various functions, plugins, themes, and other relevant stuff for your macOS device.

    Once you install this framework, you will have access to hundreds of powerful plugins and neat themes. Your new Terminal app will look customized to your preferences.

    To download it, visit the ohmyz.sh website. Once the executable file has been downloaded, install it by running this command in your terminal: $ sh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”.

    Solution #2: Configure the .zshrc File

    Are you still seeing the Zsh permission denied error? If that is the case, try configuring the .zshrc file. This file contains the script that is needed to run a new zsh shell. So, if you change this file, you need to start a new shell for the changes to take effect.

    You can then customize your terminal by running the open

    /.zshrc command. This will open the .zshrc file in your system’s root folder.

    Take note that if you are running macOS Catalina or other later versions, you may still get the same Zsh permission denied error. For this, you need to configure permissions by opening the file using the chmod +x

    Solution #3: Change the Theme of the Terminal App

    If you installed the Oh My Zsh framework, then you can proceed with this solution. Change your current Terminal app’s theme by using the ZSH_THEME=”theme_name” command.

    Solution #4: Change the Default Shell of Your System

    Another way to get rid of the Zsh permission denied error is to change the default shell of your system. To do this, follow these steps:

    1. Go to the Apple menu and select Preferences.
    2. Navigate to Users and Groups.
    3. Click the lock icon and input your user account name and password.
    4. Control+Click your user account name from the list of users.
    5. Choose Advanced Options.
    6. Select a shell from the Login Shell menu.
    7. Hit OK to apply your changes.

    How to Avoid Permission Issues on Your Mac

    To avoid permission problems in the future, you can always change the permission settings to define who can view and alter files on your device. Below are some ways to do so:

    Method #1: Assign Permissions to Users and Groups

    You may assign permissions to various users and groups to avoid permission issues on your macOS device. Here’s how:

    1. On your Mac device, choose a folder or directory.
    2. Go to File and select Get Info.
    3. If the information is not available, hit the arrow.
    4. Select a user or group and select a privilege from the pop-up menu.
    5. Hit OK to save the changes.

    Method #2: Apply Permissions to All Items

    Apply permissions to all items to ensure they can only be accessed by the right people. Follow these steps:

    1. Select a directory and go to File.
    2. Click Get Info.
    3. Check the Action Pop-Up menu and select Apply to Enclosed Items.
    4. Hit OK to save the changes.

    Method #3: Change the Item’s Owner

    If an item is owned by another user, then you will have problems with its permission. Fix it by doing this:

    1. Select an item and go to File > Get Info.
    2. If the name of the new owner is not in the list, click the Add button to add a new owner.
    3. Choose the new owner and click the Action Pop-Up menu.
    4. Click Make the owner.
    5. Apply and save the changes.

    Method #4: Add or Remove a User or Group

    Adding or removing a user or group can also resolve permission issues. Here’s how to do so:

    1. Select an item.
    2. Go to File and click Get Info.
    3. Navigate to the Sharing and Permissions section.
    4. Select Add a User or Group to add a user or group or click Remove a user or group to remove a user or group.
    5. Save the changes.

    Summary

    Getting the “permission denied” error in Mac when you’re trying to access a file is not a huge problem if you are able to open the said file by double-clicking. However, most of the time, users who experience this error are almost always unable to open the file using conventional methods.

    Since this is a permission error, you need to make sure you have enough privileges to access it. The steps above should guide you on what to do. This is quite helpful for Mac users who are not familiar with using commands or the Terminal.

    To resolve the Zsh Permission Denied error on your Mac, you have to check your file’s permissions first. It is possible that your current user account has insufficient permissions to access the file.

    If that doesn’t work, change the ownership of the directory. You can do this using the chown command.

    Also, you can try giving the Terminal app full access to your disk or use the SUDO command to grant superuser or root privileges.

    If none of the basic troubleshooting methods work, proceed with other solutions. First, try to download the Oh My Zsh framework. This method has worked for many affected users. With this framework, users can customize the Terminal app.

    Next, you can also try to configure the zshrc file itself or simply change the theme of the Terminal app. If the error persists, change your system’s default shell.

    Now, if you have tried everything but to no avail, seek help from a Mac expert. They can diagnose the problem on your behalf so you don’t have to.

    What other Mac-related errors have you encountered? Let us know in the comments.

    Источник

    Оцените статью