skip to Main Content
macbook@macbooks-MacBook-Pro ~ % flutter doctor
/Users/macbook/Downloads/flutter/bin/internal/shared.sh: line 235: /Users/macbook/Downloads/flutter/bin/cache/dart-sdk/bin/dart: Bad CPU type in executable

A sudden error on the flutter terminal after converting into bash.

currently, I convert the bash terminal to zsh terminal. still, the same error is showing while running flutter commands.

2

Answers


  1. Do following steps:

    $ nano ~/.zshrc
    

    add these lines to .zhrc file:

    export PATH="$PATH:/path/to/flutter/bin"
    export PATH="$PATH:/path/to/dart-sdk/bin"
    

    run this command:

    $ source ~/.zshrc
    

    and finally, check everything is fine:

    $ flutter doctor
    
    Login or Signup to reply.
  2. The error message "Bad CPU type in executable" indicates that there is
    a mismatch between the architecture of the Flutter/Dart executable and
    the architecture of your machine’s CPU. This commonly occurs when
    you’re trying to run an executable compiled for a different
    architecture.

    Since you mentioned that the error started happening after converting your terminal from Bash to Zsh, it’s possible that the shell change might have affected your environment settings. It’s essential to ensure that your Flutter installation and Dart SDK are compatible with your system architecture.

    Here are some steps to troubleshoot and resolve the issue:

    1. Check System Architecture:
    • Open Terminal (Zsh) and run the following command to check your Mac’s architecture: uname -m
    • Common architectures are x86_64 (Intel-based) and arm64 (Apple Silicon/M1).
    1. Reinstall Flutter:
    • Download the latest version of Flutter for your architecture from the official website (https://flutter.dev/docs/get-started/install).
    • Extract the downloaded ZIP file to a suitable location.
      Update your PATH variable to point to the new Flutter installation.
    1. Verify Dart SDK:
    • Make sure the Dart SDK bundled with Flutter is compatible with your system architecture.
    • Check the dart-sdk directory in your Flutter installation to see if it matches your system architecture.
    1. Update Environment Variables:
    • Ensure that the environment variables are correctly set in your Zsh configuration (e.g., .zshrc or .zprofile).
    • Update the PATH variable to point to the correct Dart SDK and Flutter locations.
    1. Restart Terminal:
    • After making changes to your environment settings, close and reopen your terminal for the changes to take effect.
    1. Confirm Architecture:
    • After setting up everything correctly, run flutter doctor again to verify that the error is resolved.

    If you are using an Apple Silicon/M1 Mac, you should be using the
    arm64 version of Flutter and the Dart SDK. If you are using an
    Intel-based Mac, you should use the x86_64 version.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search