用户权限和文件目录访问帮助 mac OS Sierra

用户权限和文件目录访问帮助 mac OS Sierra

我试图在终端中对我的用户和用户权限进行排序以安装 Ruby gems 和其他库,但由于权限被拒绝错误而无处可去。我尝试的步骤:

  1. 与苹果通话以整理我的用户权限,执行此命令

    diskutil resetUserPermissions / id -u

注意: id -u 在 `` 中(代码编辑将其删除)。它不起作用。仍然收到权限错误。

  1. 尝试运行 Postgres(从 GUI 安装),得到

    FATAL FATAL: role "Berzins" does not exist); (FATAL: data directory "/Users/Linards/Library/Application Support/Postgres/var-9.6" has group or world access DETAIL: Permissions should be u=rwx (0700)

在终端我是:

Linards:~ Berzins$ whoami
Berzins
Linards:~ Berzins$
  1. 在终端中运行以下命令:

Linards:~ Berzins$ dscl . -read /Groups/admin /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist: No such file or directory AppleMetaNodeLocation: /Local/Default GeneratedUID: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050 GroupMembers: FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000 6F8DC3A8-D4B6-4175-B24A-1A99756706FA GroupMembership: root Linards Berzins Linards Linards Berzins Password: * PrimaryGroupID: 80 RealName: Administrators RecordName: admin BUILTIN\Administrators RecordType: dsRecTypeStandard:Groups SMBSID: S-1-5-32-544 Linards:~ Berzins$ dscl . -read /Groups/staff /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist: No such file or directory AppleMetaNodeLocation: /Local/Default GeneratedUID: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000014 GroupMembers: FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000 6F8DC3A8-D4B6-4175-B24A-1A99756706FA FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000ED FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000EE GroupMembership: root Berzins _xcsbuildagent _xcscredserver Password: * PrimaryGroupID: 20 RealName: Staff RecordName: staff BUILTIN\Users RecordType: dsRecTypeStandard:Groups SMBSID: S-1-5-32-545 Linards:~ Berzins$

和这个:

Linards:~ Berzins$ id uid=501(Berzins) gid=20(staff) groups=20(staff),701(com.apple.sharepoint.group.1),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh) Linards:~ Berzins$

  1. 然后运行以下命令:

Linards:~ Berzins$ dscl . append /Groups/admin GroupMembership Linards /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist: No such file or directory <main> attribute status: eDSPermissionError <dscl_cmd> DS Error: -14120 (eDSPermissionError) Linards:~ Berzins$ dscl . append /Groups/admin GroupMembership Berzins /System/Library/LaunchDaemons/com.apple.DirectoryServicesLocal.plist: No such file or directory <main> attribute status: eDSPermissionError <dscl_cmd> DS Error: -14120 (eDSPermissionError) Linards:~ Berzins$

现在我陷入了困境。

任何帮助表示赞赏。

答案1

从离线讨论中,我了解到您正在尝试在 macOS 上安装 postgresql。

来自文档

自制

PostgreSQL 也可以使用 Homebrew 安装在 macOS 上。有关如何安装软件包的信息,请参阅 Homewbrew 文档。

  1. 安装自制的: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. 从终端安装 postgresql:brew install postgresql

我的输出:

$ brew install postgresql
Updating Homebrew...
==> Auto-updated Homebrew!


==> Downloading https://homebrew.bintray.com/bottles/postgresql-9.6.3.sierra.bot
######################################################################## 100.0%
==> Pouring postgresql-9.6.3.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/postgresql/9.6.3/bin/initdb /usr/local/var/postgres
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
  https://github.com/Homebrew/legacy-homebrew/issues/2510

To migrate existing data from a previous major version (pre-9.0) of PostgreSQL, see:
  https://www.postgresql.org/docs/9.6/static/upgrading.html

To migrate existing data from a previous minor version (9.0-9.5) of PostgreSQL, see:
  https://www.postgresql.org/docs/9.6/static/pgupgrade.html

  You will need your previous PostgreSQL installation from brew to perform `pg_upgrade`.
  Do not run `brew cleanup postgresql` until you have performed the migration.

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
==> Summary

相关内容