Mac Flutter Install: can't access the lockfile

1.7k Views Asked by At

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?

2

There are 2 best solutions below

8
Cyrus the Great On

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
0
Ecem On

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