Skip to content

linux run fails with "/usr/local" permissions #115376

Description

@gaaclarke

Running "flutter run" on linux can fail because of permissions to "/usr/local". It is surprising that it would make this complaint. The issue was previously reported and closed but not fixed. I'm making a new issue.

Error log

clarkeaa@gamer:~/dev/flutter-examples/counter$ flutter run
Launching lib/main.dart on Linux in debug mode...
CMake Error at cmake_install.cmake:66 (file):
  file INSTALL cannot copy file
  "/home/clarkeaa/dev/flutter-examples/counter/build/linux/x64/debug/intermediates_do_not_run/counter"
  to "/usr/local/counter": Permission denied.

Flutter doctor

[✓] Flutter (Channel stable, 3.3.8, on Ubuntu 22.04.1 LTS 5.15.68.1-microsoft-standard-WSL2, locale C.UTF-8)
    • Flutter version 3.3.8 on channel stable at /home/clarkeaa/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52b3dc25f6 (7 days ago), 2022-11-09 12:09:26 +0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

Environment

Ubuntu 22.04.1 LTS on Windows Linux Subsystem

Previously reported workaround

run flutter clean and try again

Previously closed issue

#59890

Activity

  1. added
    platform-linux
    on Nov 15, 2022
  2. stuartmorgan-g commented on Nov 15, 2022

    @stuartmorgan-g
    Contributor

    Are you able to reproduce it? It's been closed a number of times because nobody who sees it can ever reproduce it more than once. My working theory is that it's a CMake bug.

  3. stuartmorgan-g commented on Nov 15, 2022

    @stuartmorgan-g
    Contributor

    This is my previous summary of the issue: #73881 (comment)

  4. gaaclarke commented on Nov 15, 2022

    @gaaclarke
    MemberAuthor

    Are you able to reproduce it? It's been closed a number of times because nobody who sees it can ever reproduce it more than once. My working theory is that it's a CMake bug.

    I deleted that project, created a new one and the permissions problem didn't show up again. I'm not sure what is being cached where that causes it to behave differently.

    The problem with this bug is that it affects first time user experience which isn't good.

  5. added
    tool
    a: first hour
    on Nov 16, 2022
  6. ZimboPro commented on Jun 17, 2023

    @ZimboPro

    The issue was happening consistently for me, I managed to fix the issue by doing the following in linux/CMakeLists.txt

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
      set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
    endif()

    to

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)

    More info can be found in the linked issue above.

  7. shassard commented on Jun 24, 2023

    @shassard

    I ran into this issue with a fresh manual install of flutter 3.10.5 on void linux when creating a new project without all of the required build dependencies installed (no cmake, ninja, gtk+) and then attempting a build which fails, then installing all the dependencies. The project was broken at this point, but creating a new project even after removing all the dependencies and trying to reproduce the issue didn't result in a repro.

  8. added
    team-tool
    on Jul 8, 2023
  9. added
    P2
    triaged-tool
    on Jul 15, 2023
  10. cathino commented on Dec 18, 2023

    @cathino

    I run the command: flutter run -d linux, and got error:

    Launching lib/main.dart on Linux in debug mode...
    CMake Error at cmake_install.cmake:66 (file):
      file INSTALL cannot copy file
      "/media/xxx/flutter/xxx/build/linux/x64/debug/intermediates_do_not_run/xxx"
      to "/usr/local/xxx": Permission denied.
    
    
    Building Linux application...                                           
    Exception: Build process failed
    

    Flutter version is: 3.16.3.

    After using @ZimboPro 's method, it works:

    The issue was happening consistently for me, I managed to fix the issue by doing the following in linux/CMakeLists.txt

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
      set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
    endif()

    to

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)

    More info can be found in the linked issue above.

  11. pavlov061356 commented on Feb 27, 2024

    @pavlov061356

    The issue was happening consistently for me, I managed to fix the issue by doing the following in linux/CMakeLists.txt

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
      set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
    endif()

    to

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)

    More info can be found in the linked issue above.

    That worked for me, thx

  12. lomby92 commented on Mar 14, 2024

    @lomby92

    Environment

    OS: Fedora Linux 38 (Sway) x86_64
    Kernel: 6.7.9-100.fc38.x86_64
    

    Flutter

    Flutter 3.19.2 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision 7482962148 (2 settimane fa) • 2024-02-27 16:51:22 -0500
    Engine • revision 04817c99c9
    Tools • Dart 3.3.0 • DevTools 2.31.1
    

    I run flutter clean and it fixed the error

  13. 4 remaining items

  14. YousefAK009 commented on May 22, 2025

    @YousefAK009

    The issue was happening consistently for me, I managed to fix the issue by doing the following in linux/CMakeLists.txt

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
    endif()
    to

    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
    More info can be found in the linked issue above.

    worked for me. thanks

  15. added
    fyi-tool
    team-linux
    and removed
    team-tool
    on Jul 11, 2025
  16. removed
    fyi-tool
    triaged-tool
    on Jul 11, 2025
  17. added
    triaged-linux
    on Jul 18, 2025
  18. jvies commented on Oct 28, 2025

    @jvies

    The problem happened for me too on my first flutter app.

  19. jtmcdole commented on Dec 5, 2025

    @jtmcdole
    Member

    I had the same issue, but like @shassard suggests, it was most likely caused by attempting to build without having all system dependencies met.

    Installing dependencies and doing flutter clean solved the issue for me.

    I ran into this as well:

    • I had pkg-config installed by both apt and brew
    • calling flutter run -d linux would fail with gtk+-3.0 not found - I'm going to assume this is where the bad state is created.
    • export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig <- fix pkg-config
    • flutter run -d linux now wants to copy to /usr/local
    • flutter clear; flutter run -d linux works

    Unsetting PKG_CONFIG_PATH reproduces this.

  20. hlovdal commented on Dec 19, 2025

    @hlovdal

    This happened for me today. Fedora 43, using the "dart-code.flutter" extension in vs-code, selecting "Flutter: New project", "Application". Flutter not installed in advance, the "Flutter: Run flutter doctor" command eventually got it installed into /opt/flutter_dsk (owned by my user).

    First attempt to run resulted in error:

    Launching lib/main.dart on Linux in debug mode...
    CMake Error at cmake_install.cmake:66 (file):
      file INSTALL cannot copy file
      "/home/user/src/myapp/build/linux/x64/debug/intermediates_do_not_run/myapp"
      to "/usr/local/myapp": Permission denied.
    2
    
    Error: Build process failed
    

    Similar to @oliver-hrkltz I also installed gtk3-devel package after a first failed build attempt. Running flutter clean and flutter build linux manually in the command window eventually resolved the issue.

  21. yoshiask commented on May 7, 2026

    @yoshiask

    I also ran into this issue after manually setting up the Flutter SDK on Fedora 43 KDE. The first build failed due to missing gtk-3.0 dependency so I installed gtk3-devel. Second and third build attempts failed trying to copy to /usr/local/xxxx. A fourth build ran successfully after running flutter clean.

    Flutter 3.41.9 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision 00b0c91f06 (8 days ago) • 2026-04-29 10:03:19 -0700
    Engine • hash 9161402dc0e134b3fb5adee5046b6e84b1a5e1c1 (revision 42d3d75a56) (9 days ago) • 2026-04-28 17:31:55.000Z
    Tools • Dart 3.11.5 • DevTools 2.54.2
    
    Fedora Linux 43 (KDE Plasma Desktop Edition) x86_64
    Linux 6.19.14-200.fc43.x86_64
    
    Android Studio Panda 4 | 2025.3.4 Patch 1
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2a: first hourplatform-linuxteam-linuxtooltriaged-linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions