繁体   English   中英

铛:错误:无法删除文件:安装Postgres时拒绝权限

[英]clang: error: unable to remove file: Permission denied when installing Postgres

我正在尝试在机器上安装Postgres。 我正在关注这个答案

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config

我收到以下错误

Last login: Sat Oct 24 19:55:19 on ttys004
~:$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config'
This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /usr/local/opt/ruby/bin/ruby -r ./siteconf20151024-73485-3y70nd.rb extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... no
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile

make "DESTDIR=" clean
rm: pg_ext.bundle: Permission denied
rm: gvl_wrappers.o: Permission denied
rm: pg.o: Permission denied
rm: pg_binary_decoder.o: Permission denied
rm: pg_binary_encoder.o: Permission denied
rm: pg_coder.o: Permission denied
rm: pg_connection.o: Permission denied
rm: pg_copy_coder.o: Permission denied
rm: pg_errors.o: Permission denied
rm: pg_result.o: Permission denied
rm: pg_text_decoder.o: Permission denied
rm: pg_text_encoder.o: Permission denied
rm: pg_type_map.o: Permission denied
rm: pg_type_map_all_strings.o: Permission denied
rm: pg_type_map_by_class.o: Permission denied
rm: pg_type_map_by_column.o: Permission denied
rm: pg_type_map_by_mri_type.o: Permission denied
rm: pg_type_map_by_oid.o: Permission denied
rm: pg_type_map_in_ruby.o: Permission denied
rm: util.o: Permission denied
rm: .RUBYARCHDIR.time: Permission denied
make: [clean] Error 1 (ignored)

make "DESTDIR="
compiling gvl_wrappers.c
error: unable to rename temporary 'gvl_wrappers.o-4970f416' to output file 'gvl_wrappers.o': 'Permission denied'
1 error generated.
clang: error: unable to remove file: Permission denied
make: *** [gvl_wrappers.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/pg-0.18.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/pg-0.18.3/gem_make.out
~:$ 

我尝试使用sudo chmod -R 777将文件夹/Applications/Postgress.app/Contents/的权限更改为无效。

不幸的是,这不适用于Mac。 在这里,我分享了当今的真实个人经验,并且确实有效。

第一步。 安装Homebrew 这是“ OS X缺少的程序包管理器”。 如所声明的,您只能使用一个命令来执行此操作:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

它将询问您一次密码,但是之后您可以非常轻松地管理更多软件包。 安装Homebrew后,请运行brew doctor检查系统并按照说明进行操作。 如果您使用的是全新的Mac,它可能会要求您安装XCode和构建工具。

下一个。 安装PostgreSQL。

它与brew install postgres一样简单。 下载PostgreSQL及其依赖项将需要一些时间。 如果您需要比最新版本更旧的确切版本,请使用brew search postgres准确找到所需的版本。

最后。 安装pq gem。

这里没有技巧:

gem install pg
Fetching: pg-0.18.3.gem (100%)
Building native extensions.  This could take a while...
Successfully installed pg-0.18.3
1 gem installed

干杯。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM