簡體   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