I have a Flutter project from 2021 that I need to rebuild without upgrading dependencies. To manage different Flutter versions, I installed FVM and switched to Flutter 2.6 to build for iOS.
However, when I try to run pod install
in the ios
directory, I encounter the following error:
[!] Invalid `Podfile` file: undefined method `exists?' for class `File`.
My Current Environment:
- Mac: M1 (Apple Silicon) with Rosetta enabled
- Flutter: 2.6 (using FVM)
- Ruby: 3.3.6 (default system Ruby)
- CocoaPods: 1.11.3 (installed via
sudo gem install cocoapods -v 1.11.3
)
Questions:
- How can I successfully install Ruby 2.7.5 on my M1 Mac given that OpenSSL 1.1 is deprecated in Homebrew?
- Is there a workaround to make CocoaPods 1.11.3 work with Ruby 3.3.6?
- How can I resolve the
undefined method 'exists?' for class 'File'
error duringpod install
? - Is there any hope that I can run that project without having to dig deep in that wormhole of a codebase?
Any help or guidance would be greatly appreciated!
What I Have Tried:
Reinstalling Everything:
I reinstalled Flutter, FVM, Ruby, and CocoaPods.Switching to Ruby 2.7.5:
I know CocoaPods 1.11.3 is compatible with Ruby 2.7.x, so I tried to install Ruby 2.7.5 usingrbenv
:rbenv install 2.7.5
However, the installation fails with errors related to OpenSSL. I get messages like:
Error: openssl@1.1 has been disabled because it is not supported upstream! It was disabled on 2024-10-24.
Attempted Fixes for
rbenv
:- Installed dependencies using Homebrew:
arch -arm64 brew install openssl@1.1 readline libyaml gmp zlib
- Tried various environment configurations:
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
- Attempted to install using Rosetta:
arch -x86_64 rbenv install 2.7.5
- Installed dependencies using Homebrew:
Cleaning and Reinstalling CocoaPods:
sudo gem uninstall cocoapodssudo gem install cocoapods -v 1.11.3
Cleaning Pods:
pod deintegratepod cache clean --allrm Podfile Podfile.lockpod install