Error: DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead

Published: (December 11, 2025 at 02:40 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Problema

A partir de Xcode 15, el toolchain ya no se busca en la variable $DT_TOOLCHAIN_DIR sino en $TOOLCHAIN_DIR.
Al incluir una dependencia de CocoaPods, como Firebase, puede aparecer el siguiente error:

error: DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead (in target 'Firebase' from project 'Pods')

Solución

  1. Actualizar la dependencia que genera el error (por ejemplo, Firebase).
  2. Si no es posible actualizarla, buscar todas las ocurrencias de $DT_TOOLCHAIN_DIR en los archivos del pod y reemplazarlas por $TOOLCHAIN_DIR.

Script de post‑instalación (CocoaPods)

Si solo una dependencia está provocando el error, se puede añadir el siguiente bloque post_install al Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # Actualizar LIBRARY_SEARCH_PATHS
      ['Firebase.release.xcconfig', 'FirebaseAnalytics.release.xcconfig'].each do |file_name|
        Dir.glob("Pods/**/#{file_name}", File::FNM_CASEFOLD).each do |xcconfig_path|
          text = File.read(xcconfig_path)
          new_contents = text.gsub('DT_TOOLCHAIN_DIR', 'TOOLCHAIN_DIR')
          File.open(xcconfig_path, "w") { |file| file.puts new_contents }
        end
      end
    end
  end
end
Back to Blog

Related posts

Read more »

Swift #11: Cláusula de guarda

Guard statement La instrucción guard tiene una condición, seguida de un else y un bloque de guarda. Si la condición es false, se ejecuta el bloque de guarda y...

Modular Feature Architecture in SwiftUI

🧩 1. What Is a Feature Module? A feature module is a self‑contained unit representing one functional chunk of your app: Home/ Profile/ Settings/ Feed/ Auth/ O...