diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs
index ccba2034827b259a93e8f7bd5ff9e794933a707c..65be04eccc0fa8c129319b75cac52a64b2b10a0d 100644
--- a/app/ghcup/Main.hs
+++ b/app/ghcup/Main.hs
@@ -30,6 +30,7 @@ import           GHCup.Utils.Prelude
 import           GHCup.Utils.String.QQ
 import           GHCup.Version
 
+import           Cabal.Plan ( findPlanJson, SearchPlanJson(..) )
 import           Codec.Archive
 import           Control.Concurrent
 import           Control.Concurrent.Async
@@ -42,6 +43,8 @@ import           Control.Monad.Fail             ( MonadFail )
 import           Control.Monad.Logger
 import           Control.Monad.Reader
 import           Control.Monad.Trans.Resource
+import           Data.Aeson                     ( decodeStrict', Value )
+import           Data.Aeson.Encode.Pretty       ( encodePretty )
 import           Data.Bifunctor
 import           Data.Char
 import           Data.Either
@@ -1363,6 +1366,16 @@ describe_result = $( LitE . StringL <$>
                      )
                    )
 
+plan_json :: String
+plan_json = $( LitE . StringL <$>
+                     runIO (handleIO (\_ -> pure "") $ do
+                             fp <- findPlanJson (ProjectRelativeToDir ".")
+                             c <- B.readFile fp
+                             (Just res) <- pure $ decodeStrict' @Value c
+                             pure $ T.unpack $ decUTF8Safe' $ encodePretty res
+                     )
+                   )
+
 formatConfig :: UserSettings -> String
 formatConfig settings
   = UTF8.toString . YP.encodePretty yamlConfig $ settings
@@ -1381,6 +1394,9 @@ main = do
           (head . lines $ describe_result)
         )
         (long "version" <> help "Show version" <> hidden)
+  let planJson = infoOption
+        plan_json
+        (long "plan-json" <> help "Show the build-time configuration" <> internal)
   let numericVersionHelp = infoOption
         numericVer
         (  long "numeric-version"
@@ -1408,7 +1424,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
 
   customExecParser
       (prefs showHelpOnError)
-      (info (opts <**> helper <**> versionHelp <**> numericVersionHelp <**> listCommands)
+      (info (opts <**> helper <**> versionHelp <**> numericVersionHelp <**> planJson <**> listCommands)
             (footerDoc (Just $ text main_footer))
       )
     >>= \opt@Options {..} -> do
diff --git a/cabal.project b/cabal.project
index da425488ebfe0651f64fb93f43177094e1c60605..bbc95b2916a69c86af9e819928c5cb934035c7d0 100644
--- a/cabal.project
+++ b/cabal.project
@@ -23,4 +23,10 @@ constraints: http-io-streams -brotli
 package libarchive
   flags: -system-libarchive
 
+package aeson-pretty
+  flags: +lib-only
+
+package cabal-plan
+  flags: -exe
+
 allow-newer: base, ghc-prim, template-haskell, language-c
diff --git a/ghcup.cabal b/ghcup.cabal
index 207aae3d2a3899f7951101901ec4b9c42ea8e5f1..4c1d6768925f735e04279c37fadbc5a60da2acf9 100644
--- a/ghcup.cabal
+++ b/ghcup.cabal
@@ -186,9 +186,12 @@ executable ghcup
     -fwarn-incomplete-record-updates -threaded
 
   build-depends:
+    , aeson                 >=1.4      && <1.6
+    , aeson-pretty          ^>=0.8.8
     , async                 ^>=2.2.3
     , base                  >=4.13     && <5
     , bytestring            ^>=0.10
+    , cabal-plan            ^>=0.7.2
     , containers            ^>=0.6
     , deepseq               ^>=1.4
     , filepath              ^>=1.4.2.1
diff --git a/stack.yaml b/stack.yaml
index 2b83e7e5464855fbc87ea1b419785a6515891b91..fcef9793bc9fb5b722d4594f448b124c77404fd5 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -53,6 +53,12 @@ flags:
   regex-posix:
     _regex-posix-clib: true
 
+  aeson-pretty:
+    lib-only: true
+
+  cabal-plan:
+    exe: false
+
 ghc-options:
   "$locals": -O2
   streamly: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16