'Flutter -ios - pod install gRPC-C++ sed ssl issue

I have been running through this issue when I do pod install in my flutter project. (I'm going to answer this myself as I reached the solution after couple of hours - I hope it's helpful to anybody reading this in the future

Installing firebase_storage (5.0.1)
Installing flutter_local_notifications (0.0.1)
Installing flutter_plugin_android_lifecycle (0.0.1)
Installing fluttertoast (0.0.2)
Installing gRPC-C++ (1.28.2)
[!] /bin/bash -c 
set -e
sed -E -i '' 's;#include <openssl/(.*)>;#if COCOAPODS==1\
  #include <openssl_grpc/\1>\
#else\
  #include <openssl/\1>\
#endif;g' $(find src/core -type f \( -path '*.h' -or -path '*.cc' \) -print | xargs grep -H -c '#include <openssl_grpc/' | grep 0$ | cut -d':' -f1)
    find src/core/ third_party/upb/ -type f \( -name '*.h' -or -name '*.c' -or -name '*.cc' \) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "upb/(.*)";#if COCOAPODS==1\
  #include  "third_party/upb/upb/\1"\
#else\
  #include  "upb/\1"\
#endif;g'
    find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm
    find src/core/ src/cpp/ -type f \( -name '*.h' -or -name '*.c' -or -name '*.cc' \) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\
  #include  "src/core/ext/upb-generated/\1.upb.h"\
#else\
  #include  "\1.upb.h"\
#endif;g'
    find src/core/ src/cpp/ -type f -name '*.grpc_back' -print0 | xargs -0 rm

sed: can't read s;#include <openssl/(.*)>;#if COCOAPODS==1\
  #include <openssl_grpc/\1>\
#else\
  #include <openssl/\1>\
#endif;g: No such file or directory


Solution 1:[1]

In the ios folder run

brew unlink gnu-sed

then

Pod install

Solution 2:[2]

You need to remove the gnu-sed Path variable.

/usr/local/Cellar/gnu-sed/4.8/libexec/gsed

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 André Kuhlmann
Solution 2 Mersad