3

Каждый раз, когда я запускаю свой терминал, я получаю это сообщение об ошибке:

-bash: /Users/myusername/.profile: В доступе отказано

Я все еще могу использовать терминал, как обычно, хотя.

Вероятно, это произошло после того, как я установил что-то, использующее терминал.
Кажется, что-то пытается получить доступ к .profile который не существует.
Обратите внимание, что .bash_profile существует.

Я запустил команду:

grep -n profile ~/.* 2>/dev/null

И получил этот результат:

/Users/myusername/.v8flags.3.14.5.9.myusername.json:1:["--use_strict","--es5_readonly","--es52_globals","--harmony_typeof","--harmony_scoping","--harmony_modules","--harmony_proxies","--harmony_collections","--harmony","--packed_arrays","--smi_only_arrays","--clever_optimizations","--unbox_double_arrays","--string_slices","--crankshaft","--hydrogen_filter","--use_range","--eliminate_dead_phis","--use_gvn","--use_canonicalizing","--use_inlining","--max_inlined_source_size","--max_inlined_nodes","--max_inlined_nodes_cumulative","--loop_invariant_code_motion","--collect_megamorphic_maps_from_stub_cache","--hydrogen_stats","--trace_hydrogen","--trace_phase","--trace_inlining","--trace_alloc","--trace_all_uses","--trace_range","--trace_gvn","--trace_representation","--stress_pointer_maps","--stress_environments","--deopt_every_n_times","--trap_on_deopt","--deoptimize_uncommon_cases","--polymorphic_inlining","--use_osr","--array_bounds_checks_elimination","--array_index_dehoisting","--dead_code_elimination","--trace_dead_code_elimination","--trace_osr","--stress_runs","--optimize_closures","--lookup_sample_by_shared","--cache_optimized_code","--inline_construct","--inline_arguments","--inline_accessors","--loop_weight","--optimize_for_in","--opt_safe_uint32_operations","--parallel_recompilation","--trace_parallel_recompilation","--parallel_recompilation_queue_length","--experimental_profiler","--watch_ic_patching","--frame_count","--self_optimization","--direct_self_opt","--retry_self_opt","--count_based_interrupts","--interrupt_at_exit","--weighted_back_edges","--interrupt_budget","--type_info_threshold","--self_opt_count","--trace_opt_verbose","--debug_code","--code_comments","--enable_sse2","--enable_sse3","--enable_sse4_1","--enable_cmov","--enable_rdtsc","--enable_sahf","--enable_vfp3","--enable_vfp2","--enable_armv7","--enable_sudiv","--enable_movw_movt","--enable_unaligned_accesses","--enable_fpu","--expose_natives_as","--expose_debug_as","--expose_gc","--expose_externalize_string","--stack_trace_limit","--builtins_in_stack_traces","--disable_native_files","--inline_new","--stack_trace_on_abort","--trace","--mask_constants_with_cookie","--lazy","--trace_opt","--trace_opt_stats","--opt","--always_opt","--prepare_always_opt","--trace_deopt","--min_preparse_length","--always_full_compiler","--max_opt_count","--compilation_cache","--cache_prototype_transitions","--trace_debug_json","--debugger_auto_break","--enable_liveedit","--break_on_abort","--stack_size","--max_stack_trace_source_length","--always_inline_smi_code","--max_new_space_size","--max_old_space_size","--max_executable_size","--gc_global","--gc_interval","--trace_gc","--trace_gc_nvp","--trace_gc_ignore_scavenger","--print_cumulative_gc_stat","--trace_gc_verbose","--trace_fragmentation","--trace_external_memory","--collect_maps","--flush_code","--incremental_marking","--incremental_marking_steps","--trace_incremental_marking","--track_gc_object_stats","--use_idle_notification","--use_ic","--native_code_counters","--always_compact","--lazy_sweeping","--never_compact","--compact_code_space","--incremental_code_compaction","--cleanup_code_caches_at_gc","--random_seed","--use_verbose_printer","--allow_natives_syntax","--trace_parse","--trace_sim","--check_icache","--stop_sim_at","--sim_stack_alignment","--abort_on_uncaught_exception","--trace_exception","--preallocate_message_memory","--randomize_hashes","--hash_seed","--preemption","--regexp_optimization","--testing_bool_flag","--testing_int_flag","--testing_float_flag","--testing_string_flag","--testing_prng_seed","--testing_serialization_file","--extra_code","--dump_counters","--debugger","--remote_debugger","--debugger_agent","--debugger_port","--map_counters","--js_arguments","--debug_compile_events","--debug_script_collected_events","--gdbjit","--gdbjit_full","--gdbjit_dump","--gdbjit_dump_filter","--force_marking_deque_overflows","--stress_compaction","--log","--log_all","--log_runtime","--log_api","--log_code","--log_gc","--log_handles","--log_snapshot_positions","--log_suspect","--prof","--prof_auto","--prof_lazy","--prof_browser_mode","--log_regexp","--sliding_state_window","--logfile","--ll_prof","--gc_fake_mmap"]

Я также добавил set -x в конец файла /etc /profile и получил такой результат:

Last login: Mon Oct  5 21:54:04 on ttys001
+ export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin
+ PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin
+ export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin
+ PATH=/Applications/MAMP/bin/php/php5.5.10/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin
+ /Users/myusername/.profile
-bash: /Users/myusername/.profile: Permission denied
+ [[ -s /Users/myusername/.rvm/scripts/rvm ]]
+ source /Users/myusername/.rvm/scripts/rvm
++ builtin test -n '3.2.53(1)-release' -o -n '' -o -n ''
++ case "`uname`" in
+++ uname
+++ command ps -p 14417 -o ucomm=
+++ ps -p 14417 -o ucomm=

Мне кажется, что приложение MAMP вызывает проблему, я прав?

2 ответа2

1

Чтобы исследовать вашу проблему с загрузочными файлами rc , вы можете сгенерировать трассировку для каждой команды, например:

  1. Отредактируйте /etc/profile (например, sudo vim /etc/profile).
  2. Добавьте set -x в конце файла.
  3. Откройте новое окно терминала, и оно покажет вывод трассировки.

Получив трассировку, вы можете легко определить источник вашей проблемы с отказом в доступе (выполнив поиск с помощью: +f). Как только вы удалите проблемную строку, избавьтесь от set -x который вы добавили.

0

Я нашел проблему. У меня была эта строка в ~/.bash_profile:

~/.profile

Я удалил ту строку, которая решила проблему.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .