0

I've been able to use flutter to create apps on my mac using my "work user account".

I now want to be able to login as myself and create apps so I've created a new user. I've made the workaccount path to flutter rw for "staff" and using my personalaccount I can access all the files. ls -l confirms I have rw access to the lockfile. I tried deleting the lockfile but that didn't help.

I've updated $PATH and my workaccount flutter is there when I echo.

I've tried killall -9 dart on my workaccount .

When I run flutter doctor -v I still get this:

Flutter failed to open a file at "/Users/workaccount/Development/flutter/bin/cache/lockfile". > The flutter tool cannot access the file or directory. Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.

#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 _throwFileSystemException (package:flutter_tools/src/base/error_handling_io.dart:778:3) #2 _handlePosixException (package:flutter_tools/src/base/error_handling_io.dart:726:3) #3 _runSync (package:flutter_tools/src/base/error_handling_io.dart:583:7) #4 ErrorHandlingFile.openSync (package:flutter_tools/src/base/error_handling_io.dart:291:12) #5 Cache.lock (package:flutter_tools/src/cache.dart:304:24) #6 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:240:31) #7 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:236:13) #8 AppContext.run. (package:flutter_tools/src/base/context.dart:150:29) #9 AppContext.run. (package:flutter_tools/src/base/context.dart:150:7) #10 _rootRun (dart:async/zone.dart:1354:13) #11 _CustomZone.run (dart:async/zone.dart:1258:19) #12 _runZoned (dart:async/zone.dart:1789:10) #13 runZoned (dart:async/zone.dart:1711:10) #14 AppContext.run (package:flutter_tools/src/base/context.dart:149:12) #15 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:19) #16 run.. (package:flutter_tools/runner.dart:62:9) #17 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #18 main (package:flutter_tools/executable.dart:91:3)

My mac skills aren't great, can anyone suggest something that might work?

Sarah K
  • 363
  • 2
  • 15

2 Answers2

1

you may run this command :

 $ sudo chown -R <username> /Users/workaccount/Development/flutter/bin/cache/lockfile

more info :

Check permission for the mentioned directory via:

ls -l /home/raphael/flutter/

the flutter subfolder in there should have the same user id (or the group) as your current user, with whom you are trying to create the project.

If not, while being in the folder mentioned above, try to change permission on the folder via:

chown -R YOUR_USERNAME flutter

Run the first command again to verify that the apropriate user is now shown on the folder. Then try to create the project again.

Update

If you want to have permission on each account you can do it:

sudo chmod 777 /Users/workaccount/Development/flutter/bin/cache/lockfile
Cyrus the Great
  • 5,145
  • 5
  • 68
  • 149
  • The owner is my work account. I'm looking for a permanent solution. I don't want to have to change the ownership every time I change accounts. – Sarah K Sep 12 '21 at 05:43
  • You can do it just time and you don't need to repeat that every time.@SarahK – Cyrus the Great Sep 12 '21 at 06:04
  • But then when I go to use my work account won't I have this problem? I need to be able to switch between the two accounts. – Sarah K Sep 12 '21 at 06:24
  • 1
    I updated my answer, Last line . @SarahK – Cyrus the Great Sep 12 '21 at 06:42
  • I've done that, `ls -l` confirms it, but still doesn't work. Have been recommended the package FVM but you have to have a working version of flutter to actually get it working! – Sarah K Sep 12 '21 at 22:51
  • I am using fvm instead of separat sdk for each project. You can test that to see.. – Cyrus the Great Sep 13 '21 at 03:01
  • Did you change folder permission? If not, change flutter folder with all insided files permission to 777 – Cyrus the Great Sep 13 '21 at 03:02
  • Hi, yes, I changed the permissions to 777. Have discovered brew has the same problem so trying to get the setup done right this time. Found a medium article called "Homebrew Multi User Setup" but that hasn't seemed to help either. – Sarah K Sep 14 '21 at 04:08
0

you go to documents and command+up+. and you can see .bashrc, you must add your path (export PATH="$PATH:/Users/ecemE/flutter/bin"

my path) after terminal off and open again, write flutter doctor and fix this problem :D

Ecem
  • 1
  • 1