diff --git a/meta/recipes-devtools/ruby/ruby_4.0.6.bb b/meta/recipes-devtools/ruby/ruby_4.0.6.bb
index 13b6746bbeb3..2bbe434f196a 100644
--- a/meta/recipes-devtools/ruby/ruby_4.0.6.bb
+++ b/meta/recipes-devtools/ruby/ruby_4.0.6.bb
@@ -78,7 +78,7 @@ EXTRA_OECONF:append:libc-musl = "\
 
 PARALLEL_MAKEINST = ""
 
-do_install:append:class-target () {
+ruby_scrub_rbconfig () {
     rbconfig_rb=`find ${D} -name rbconfig.rb`
     # Remove build host directories
     sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \
@@ -97,6 +97,16 @@ do_install:append:class-target () {
     find ${D} -name gem_make.out -delete
 }
 
+# Not for class-native: those paths point into the native sysroot and are
+# correct there, and scrubbing them leaves ruby-native naming the host's /usr.
+do_install:append:class-target () {
+    ruby_scrub_rbconfig
+}
+
+do_install:append:class-nativesdk () {
+    ruby_scrub_rbconfig
+}
+
 do_install_ptest () {
     cp -rf ${S}/test ${D}${PTEST_PATH}/
     install -D ${S}/tool/test/init.rb ${D}${PTEST_PATH}/tool/test/init.rb
