Mix ecto.create: permission denied

Hello, I am currently trying to install elixir and all its components and i keep hitting brick walls (Pls in helping, kindly go as easy on me as possible. This is my 1st programming language ever)

the latest of them is:

$ mix ecto.create

warning: found quoted keyword “test” but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes

mix.exs:57

Error reading file /Users/macbook/.config/rebar3/rebar.config: permission denied

** (Mix) Could not compile dependency :ranch, “/Users/macbook/.mix/rebar3 bare compile --paths=”/Users/macbook/hello/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with “mix deps.compile ranch”, update it with “mix deps.update ranch” or clean it with “mix deps.clean ranch”

Hi @SimplyEl ca you describe how you installed Elixir? It looks like you installed Elixir or Erlang as root, which is causing issues.

i initially used a tutorial online and everything seemed fine at first until i tried to run the 1st example programs; arithmetic worked fine but the “hello world” kept giving me error. I used Atom as the editor.
I then decided to use another tutorial and this was the procedure i followed:

$ brew update
$ brew install elixir

$ iex
iex> IO.puts “hello world from elixir”

$ mix local.hex
$ brew upgrade elixir

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
The above link didn’t install so i downloaded the ‘phx_new.ez’ on my mac and install it from there and it installed fine (i believe)

$ mix phx.new hello

$ cd hello (worked fine)

$ mix ecto.create (this is where i encountered the above stated problem)

Thanks for responding in so brief a time

Ah yeah I don’t really recommend using home brew for elixir. asdf works a lot more easily in my experience.

You’ll need asdf itself, found here: asdf | asdf
And then the erlang plugin. Be sure to note the OS X instructions in the readme.
GitHub - asdf-vm/asdf-erlang: Erlang plugin for asdf version manager

And lastly the Elixir plugin GitHub - asdf-vm/asdf-elixir: Elixir plugin for asdf version manager

but the “hello world” kept giving me error.
what error did you get?

I cant no longer recall the “hello world” error msg.

do i need to uninstall the home brew for elixir before i go on with your suggestion (if yes, how?) or can i just go ahead?

Yeah that is probably a good idea: brew remove elixir brew remove erlang

ok. Thanks. Let me start working on that at once, i will let you know how it goes.

Thanks for your prompt response… it is an encourager to my spirit :smile:

1 Like

Still getting the ‘Access Denied’ msg

Below are the processes and response:

macbook$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.8

Cloning into ‘/Users/macbook/.asdf’…

remote: Enumerating objects: 22, done.

remote: Counting objects: 100% (22/22), done.

remote: Compressing objects: 100% (18/18), done.

remote: Total 5340 (delta 7), reused 13 (delta 4), pack-reused 5318

Receiving objects: 100% (5340/5340), 1001.06 KiB | 161.00 KiB/s, done.

Resolving deltas: 100% (3004/3004), done.

Note: checking out ‘4a3e3d6ebd1b544d0618a077a14165566d5b7a4a’.

You are in ‘detached HEAD’ state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

warning: unable to access ‘/Users/macbook/.config/git/attributes’: Permission denied
macbook$ . $HOME/.asdf/asdf.sh
macbook$ . $HOME/.asdf/completions/asdf.bash

macbook$ asdf update

warning: unable to access ‘/Users/macbook/.config/git/attributes’: Permission denied

warning: unable to access ‘/Users/macbook/.config/git/ignore’: Permission denied

HEAD is now at 4a3e3d6… Update version to 0.7.8

Updated asdf to release v0.7.8

macbook$ asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git

warning: unable to access ‘/Users/macbook/.config/git/attributes’: Permission denied

or is something missing from my system?

Couple of things!

  1. Please use code blocks for this stuff so that it is easier to read.

  2. I do think you messed up your permissions somehow. Try sudo chown -R macbook ~/.config/

1 Like

VIOLA!
For the first time ever since i have been trying to install elixir things, i got no error msg. (i am screeming this out of excitement but u cant hear me)

“sudo chown -R macbook ~/.config/”

surely fixed it (i guess my password has been hindering access all the while).

Does that mean i have to use the ‘sudo chown’ everytime i launch the terminal for elixir use?
And could this be the reason why i have been suffering all these while from the beginning of my trying to code in elixir?
i am really relieved, you dont know how much relief this has brought me.

QUESTions:

  1. how do i test it to make certain that all is actually well, can u suggest any simple code?
  2. I dont understand what u mean by to use code blocks?

Thank you so much sir! i cant wait to get to where you are today👍🏼

I’m glad this helped! No, you should not need to do this, I think you somehow caused a misconfiguration in your general system related to git, there is nothing Elixir specific about this.

Answers:

  1. If you didn’t get any errors it should probably be fine, just go ahead with some Elixir learning projects and see what happens
  2. In this forum, you can use ``` to create a block of code like this:
# this is formatted like code
IO.puts "fooo"

You do ``` then a new line, then the code, then another ```.

To be more exact, you can use Markdown in forum posts to format them.

The following will render as what you see below the block.

```ex
# There are a lot of stuff possible, like this fenced code block.
```

~~~plain
and also the tilde fence is understood
~~~

> Additionally quotations are possible

And `inline` code (though only with backticks)

* Ofcourse
* Bulletpoint
* lists are not allowed to miss

1. as well as
2. numbered lists

There are more things possible, but these are the most common to use.

# There are a lot of stuff possible, like this fenced code block.
and also the tilde fence is understood

Additionally quotations are possible

And inline code (though only with backticks)

  • Ofcourse
  • Bulletpoint
  • lists are not allowed to miss
  1. as well as
  2. numbered lists

There are more things possible, but these are the most common to use.

Thanks so much for everything… i am grateful.

I just did the iex command to check to see its working fine but says, “command not found”

$ iex
“-bash: iex: command not found”

Does this mean the installation was unsuccessful. i actually did the asdf process all over again to make sure.

Ah yeah you need to set a global elixir, what version did you install? What do you get when you run asdf list elixir and asdf list erlang?

for both elixir and erlang, it says

“no version installed”

Ah so asdf is a version manager, it isn’t itself elixir or erlang. Now that you have asdf installed you need to use it to actually install erlang / elixir. I’d recommend using the latest versions:

asdf install erlang 23.0.1
asdf install elixir 1.10.3-otp-23

Then, once those work, activate those versions:

asdf global erlang 23.0.1
asdf global elixir 1.10.3-otp-23

Thanks. the install was successful.
However, i have started to encounter the same error msg as before

  iex(1)> IO.puts hello
  ** (CompileError) iex:1: undefined function hello/0
  (stdlib 3.13) lists.erl:1354: :lists.mapfoldl/3

for another code i have

   iex(1)> string.reverse "madamimadam"
  ** (CompileError) iex:1: undefined function string/0

the only one that works is the arithmetic

iex(4)>  5*5
25

i then opened a new terminal while i left the other opened and typed “iex”, this is what i got

$ iex
-bash: iex: command not found

i also tried

$ asdf install erlang 23.0.1
-bash: asdf: command not found

Nothing seem to work in the new terminal.

You need to put hello in quotes to make it a string, rather than variable lookup/function call: "hello".

The modules name is String (capital S), not string.

Then you haven’t enabled asdf properly in your shells rc file.

Depending on your operating system, your shell and how you installed asdf there are subtle differences.

For a git clone to ~/.asdf and bash adding the following lines to ~/.bashrc and then exiting your terminal and starting a fresh should work.

if [ -f ~/.asdf/asdf.sh ]; then
  . $HOME/.asdf/asdf.sh  # The small dot in front of `$HOME` is important!
fi

If though you did not a git clone of the asdf repository, or you are not using bash, then the path needs to be different, or the file to edit might be another one.

I tried your above suggestion and nothing at all.

After putting in the command, the terminal just displays
" >"
and that is all. Whatever i type in, it will still display
“>”
I am now even more confused and kind of frustrated.

After putting what command?